Trick To Solving Sudoku Revealed By PM

Trick To Solving Sudoku Revealed By PM

The prime minister of Singapore has published code on his Facebook page for the program he wrote to solve Sudoku puzzles.

Lee Hsien Loong said he wrote the code a few years ago using the C++ programming language.

He revealed the side project while launching the government's new technology initiative to encourage people to code.

He told industry leaders: "The last program I wrote was a Sudoku solver in C++ several years ago, so I'm out of date.

"My children are in IT, two of them - both graduated from MIT. One of them browsed a book and said, 'Here, read this.' One day that will be my retirement reading."

He then uploaded the code to Google Drive and posted a link to his Facebook page.

He wrote: "The program is pretty basic. Type in the data line by line then the solver will print out the solution, the number of steps the program took searching for the solution, plus some search statistics.

"Hope you have fun playing with this. Please tell me if you find any bugs!"

Mr Lee graduated from Cambridge University with a degree in maths and a diploma in computer science.

His country is trying to position itself as a place of computer and technological innovation.