Data Structures & AlgorithmsVery hardGATE CS · TCS NQT
How many integers from 1 to 100 inclusive have an odd number of positive divisors?
- A. 11
- B. 10
- C. 50
- D. 12
Correct answer: B. 10
A number has an odd divisor count exactly when it is a perfect square (divisors pair up otherwise). The squares up to 100 are 10 in number.
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
- What is the length of the longest common substring (contiguous) of "abcdef" and "zcdemf"?
- When converting the infix expression "(a+b)(c-d)/e" to postfix, how many operator symbols appear in the postfix output?
- What is the sum of all odd positive divisors of 180?
- How many distinct sums arise from the length-3 windows of [1, 1, 2, 2, 3, 3, 1]?
- Among index pairs i < j of [-8, -3, -1, 2, 5, 9], how many pairs have the minimum possible absolute value of their sum?
- For [4, 1, 3, 7, 2], what is the maximum over index pairs i < j of min(a[i], a[j]) times (j - i)?