Programming and national leaders are not a combination you hear of everyday. That is of course unless you happen to be the prime minister of Singapore and your name happens to be Lee Hsien Loong.

So what makes Lee so special? A few weeks ago, at a speech at the Founders Forum Smart Nation Singapore Reception, Lee told the audience that he was somewhat of an avid programmer. In addition, he also let loose that the last program he wrote was a Sudoku solver in C++. Using what is known as a backtrack search, the program chooses the next cell to guess. This apparently reduces the fan-out.

To use the program, just enter in the values of each row. The program then will do its thing and print out the solution (or multiple solutions). The total number of steps taken by the program to search for the solution, and some search statistics thrown in there for good measure as well.

To make things more interesting, the prime minister also announced that the code for his program is available to download via a link to a Google Drive folder and provided a screenshot as well.

Lee has a first class honors degree in mathematics from Cambridge where he also held the title of Senior Wrangler. He has two children, both graduates of MIT. He also recalls one of his children handing him a book on Haskell programming language with the words, “Here, read this”.

“One day that will be my retirement reading”.

In conclusion, Lee tells those gathered that he hopes they have fun playing with the program and to let him know if there are any bugs.