Category: algorithms
The Hamming Distance is the number of different symbols between two strings/numbers (equal length). It can be also considered as the number of changes required to convert from one …
Given n items with size A (i from 0 to n – 1), an integer m denotes the size of a backpack. How full you can fill this backpack? …
Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it in O(n) time and O(1) …
Simulated Annealing is a general-purpose meta heuristic optimization algorithm. It is similar to hill climbing but SA has the ability to jump out of local optimal with a decreasing …
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. …