I told the Founders Forum two weeks ago that the last computer program I wrote was a Sudoku solver, written in C++ several years ago (http://bit.ly/1DMK5Zk). Someone asked me for it. Here is the source code, the exe file, and a sample printout - http://bit.ly/1zAXbua
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), the number of steps the program took searching for the solution, plus some search statistics.
For techies: the program does a backtrack search, choosing the next cell to guess which minimises the fanout.
Here’s a question for those reading the source code: if x is an (binary) integer, what does (x & -x) compute?
Hope you have fun playing with this. Please tell me if you find any bugs! – LHL
#SmartNation
===========
Answer: As several of you noted, (x & –x) returns the least significant ‘1’ bit of x, i.e. the highest power of two that divides x. This assumes two’s complement notation for negative numbers, as some of you also pointed out. e.g. if x=12 (binary 1100), then (x & -x) = 4 (binary 100). I didn’t invent this; it is an old programming trick. :)
===========
Update: A few people suggested that I add a licence to the code. Have added it in the Google Drive folder.
同時也有10000部Youtube影片,追蹤數超過62萬的網紅Bryan Wee,也在其Youtube影片中提到,...
「smartnation」的推薦目錄:
- 關於smartnation 在 Lee Hsien Loong Facebook
- 關於smartnation 在 Lee Hsien Loong Facebook
- 關於smartnation 在 Lee Hsien Loong Facebook
- 關於smartnation 在 Bryan Wee Youtube
- 關於smartnation 在 Travel Thirsty Youtube
- 關於smartnation 在 スキマスイッチ - 「全力少年」Music Video : SUKIMASWITCH / ZENRYOKU SHOUNEN Music Video Youtube
- 關於smartnation 在 Smart Nation Singapore - YouTube 的評價
- 關於smartnation 在 13 Smart Nation ideas - Pinterest 的評價
smartnation 在 Lee Hsien Loong Facebook 八卦
In my National Day Message, I spoke on three areas that will help Singapore prepare for the future: better pre-schools, beating diabetes, and building a #SmartNation.
You can also read my full speech here: on.pmo.sg/2foN886
– LHL
smartnation 在 Lee Hsien Loong Facebook 八卦
In Silicon Valley last month, I met Singaporean software engineers, data scientists and tech professionals working for companies like Facebook, Google, Quora, Uber and Dropbox. I am glad they are finding fulfillment and challenge in their jobs, and flying our flag abroad. But I also hope they will come home to Singapore one day.
Yesterday, IDA Singapore announced the Smart Nation Fellowship Programme. The aim is to attract people who can take our Smart Nation Initiative further. Whether they have been working at tech companies overseas, or in the private sector or academia in Singapore, the Fellows will work on exciting and pathbreaking projects for Singapore.
Find out more about the Fellowship programme here: https://fellowships.data.gov.sg/
– LHL
(MCI Photo by Kenji Soon)
#SmartNation
smartnation 在 13 Smart Nation ideas - Pinterest 的八卦
Aug 23, 2017 - Explore Malcolm Yam's board "Smart Nation" on Pinterest. See more ideas about smart, national, singapore. ... <看更多>
smartnation 在 Smart Nation Singapore - YouTube 的八卦
Smart Nation Singapore: Smart Moves Ahead. •. 244,897 views 1 year ago ... Which one fits you? Visit techcareers.smartnation.gov.sg to find out more. ... <看更多>