Data Structures & AlgorithmsHardGATE CS · ICPC regional
How many positive divisors of 720 are perfect squares?
- A. 7
- B. 4
- C. 9
- D. 6
Correct answer: D. 6
720 = 2^4 * 3^2 * 5. A divisor is a square exactly when every prime exponent is even, so count choices of even exponents: 3 choices for 2^4, 2 for 3^2, 1 for 5.
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
- Two people in a circle of 5 are numbered 1 to 5 and eliminated by repeatedly removing every second person (starting by removing person 2)…
- How many index pairs i < j in the array [1, 2, 3, 4, 5, 6] satisfy gcd(a[i], a[j]) = 1 and a[i] + a[j] is odd?
- What is the number of elements remaining in the list after deleting each element that is smaller than the element immediately before it…
- How many NON-EMPTY subsets of [3, 6, 9, 12, 15, 4, 8, 11] (chosen by index, so equal values are different elements) have a sum divisible…
- How many subsets of {1, 2, 3, 4, 5, 6, 7, 8} have sum exactly 15? (The empty set is excluded, and each value is used at most once.)
- How many arrays of length 4 with values from {1, 2, ..., 3} have no two adjacent elements equal?