Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
What is the smallest positive integer that is divisible by every integer from 1 to 12 and is also a perfect square?
- A. 21344399
- B. 21344400
- C. 21344402
- D. 42688800
Correct answer: B. 21344400
The lcm of 1 to 12 is 27720 = 2^3 * 3^2 * 5 * 7 * 11. A perfect square needs every prime to an even power, so x must be divisible by 2^2 * 3 * 5 * 7 * 11 = 4620, and the answer is 4620^2.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- A string is compared to a pattern by repeatedly rotating its first character to the end. How many distinct rotations of abab exist…
- What is the length of the longest substring of abcabdabcd that contains at most two distinct characters?
- How many pairs of distinct positions (i, j) with i < j in the string abcdcba satisfy s[i] = s[j]?
- In the sequence of queue operations enqueue 5, enqueue 3, dequeue, enqueue 8, dequeue, dequeue, enqueue 1, what is the value at the front…
- For the pattern "aabaabaaab" (0-based), what is the value of the KMP prefix function π at the LAST index? π[i] is the length of the…
- How many times does the pattern "aaa" occur in the text "aaaabaaaaab", counting OVERLAPPING occurrences (occurrences may share letters)?