Sudoku is a great little puzzle for passing the time on a train or while waiting for a friend. There are numerous Soduku-solving strategies that people swear by, and coders have even created their own Sudoku solver algorithms.

Now add Singapore Prime Minister Lee Hsien Loong to the list of Sudoku solvers. Lee recently revealed his algorithm, which he created using the general-purpose programming language C++, earning him plenty of new fans along the way. Lee discussed his programming skills during a Founders Forum that promoted the tech industry within the country.

"I used to enjoy this; it is a long time since I’ve done any [coding]. The last program I wrote was a Sudoku solver in C++ several years ago, so I’m out of date," Lee said as he described the work of Minister Vivian Balakrishnan, a "hacker and dabbler" who is in charge of the Smart Nation Program Office. Lee, 63, graduated from Trinity College, University of Cambridge, with a diploma in computer science.

His comments piqued the interest of many, so Lee shared his Sudoku solver on Facebook on Monday. "The program is pretty basic: It runs at the command prompt, in a DOS window. Type in the data line by line (e.g. 1-3-8---6), then the solver will print out the solution (or all the solutions, if there are several)," Lee wrote in the post. He shared a sample printout and a Google Drive link where users can download the Sudoku solver.