Playing in support of

Where does my money go?


Donations stay local to fund critical treatments, healthcare services, pediatric medical equipment and charitable care.

Learn more about this hospital
George Martin profile picture

George Martin

Extra Life 2021


Prime Minister of Singapore wrote a program to solve Sudoku online

The Prime Minister of Singapore, Li Hsien Loong, posted on his Facebook profile the code of a program he wrote to solve Sudoku. The program is written in C ++ and takes as input line by line the initial condition of the Sudoku puzzle and then outputs one or more solutions.

Two weeks ago, at an event to celebrate the launch of a state technology initiative, Lee mentioned that he wrote his last program a few years ago. In his commentary on the post, the Prime Minister describes how the program works, and also asks his readers a question about what one of the fragments of his code does.

Li Hsien Song graduated from Trinity College, Cambridge University with a degree in mathematics and a degree in computer science. He has served as prime minister since August 12, 2004. It is curious to note that he is not the first of the heads of state to demonstrate programming skills. In December 2014, Barack Obama took part in the opening of Educational Computer Science Week and became the first American president to write a computer program. It was a very simple program that draws a square on the screen. Obama preferred JavaScript to write it.