Hello everyone! I am back with a new set of puzzles (18 to be exact).
As the title suggests, these 18 puzzles revolve around permutations, combinations, sequences, and random numbers. And of course the solutions are provided as well (written in Microsoft SQL Server’s T-SQL).
This set of puzzles includes using recursion to create a numbers table, calculate factorials, generate growing numbers, and string auditing. Also included are puzzles and solutions that solve the Birthday problem, the Josephus problem, calculate any position in Pascal’s Triangle, simulate the Monty Hall problem, and perform some fun hacker statistics using random numbers and the law of large numbers.
These types of puzzles may not seem a good fit for SQL, but after you understand how to use recursion, sequence objects and the NEWID() function to randomizing datasets, they become quite easy to solve.
As with all of my writings, I will be updating this regularly with any new puzzles and any new solutions I can conjure. Here is a link to my GitHub repository where it’s located. There is a PDF with the puzzles, and a folder that contains all the solutions written in T-SQL.
Also, I’ve added quite a few new puzzles to my original puzzle list which is now up to 58 and counting.
If you have any good suggestions for puzzles, or if you have a solution that you think I should include, definitely contact me through the contact page on this website.