Data Structures & AlgorithmsModerateCodeforces Div2 B · number theory
Problem: What is the purpose of the 'lowest common multiple of the array' technique in competitive programming?
- A. Combining periodicities of several cycles into one period
- B. Computing shortest paths
- C. Counting connected components
- D. Sorting by frequency
Correct answer: A. Combining periodicities of several cycles into one period
The lcm of cycle lengths gives the smallest time at which all cycles realign.
More Coding Interview Problems questions
- Problem: In counting sort, what limits its use on a large input?
- Problem: What does the expression 'x & (x - 1)' clear in the binary representation of x?
- Problem: Which algorithm solves the 'minimum cost to connect all points' in the Euclidean plane with n points in O(n^2) time (dense graph)?
- Problem: What is the time complexity of building a trie for n strings of total length L?
- Problem: What is a 'bridge' in an undirected graph?
- Problem: Which algorithm finds the strongly connected components of a directed graph using a single DFS with a stack?