Tag: c++
Write a method to check if a given integer is a perfect square e.g. 4, 9, 16, 25 … you cannot use the sqrt or pow functions. One solution …
A point is chosen randomly in a square. 4 lines are drawn to connect this point with the 4 vertices of this square, such that 4 triangles are formed. …
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. For example, given two integers x=1 and y=4, the hamming distance …
I describe two solutions in C++ and C# to the LineSpace Algorithm and I tested using the following pseudo-code: const int N = 1000; // number of test samples …
You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the …