Algorithm


C# Rotate the square matrix

This is one of my questions from an interview. The interviewer asked me to rotate a square matrix in C#. While it is not so hard for me and I have done it in 10 minutes, I'd share my solution to all developers who may need this. namespace Test { class Program { static void Main(string[] args) { var a = new int[][] { new int[] …


Get unique random numbers in C#

The source code this blog mentioned is here: https://github.com/Anduin2017/SuperRandom The traditional methods for obtaining `n` non-repeating random numbers are: The random number is generated by the linear congruence method, and each random number is generated and compared in the database. If it already exists, the number is discarded. Randomly generate a linear sequence, and then …