Tag: algorithm
PHP Provides str_rot13 function to rotate alphabetic characters by 13 places. However, there is no str_rot47 function to rotate 47 places over a larger mapping table. The following is …
The Longest Increasing Sequence (LIS) asks for the longest increasing sequence in a list of numbers. For example, in the list 1, 6, 2, 5, 4, 7, the longest …
Fermat Prime Test Algorithm is to check whether a number is prime. It is a probabilistic approach that based on the following observation. . This is also known as …
The problem is from codeforces: http://www.codeforces.com/problemset/problem/245/E The minimal number of people can be obtained by greedy approach, assuming that at each possible cases, the same people entered and left …
In , the GCD (Greatest Common Divisor) is given in brief details. The algorithm can be implemented in both recursive and iterative forms. The recursive formula is , and …