Data Structures & AlgorithmsVery hardGATE CS · TCS NQT
How many integers n with 1 <= n <= 1000 have n^2 divisible by 36?
- A. 167
- B. 166
- C. 27
- D. 165
Correct answer: B. 166
n^2 divisible by 36 = 2^2 * 3^2 is equivalent to n divisible by 6, since each exponent must be at least 1. There are 166 multiples of 6 up to 1000.
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
- How many palindromic substrings of length at least 2 occur in "aaa" (counted by position)?
- Weights [2, 3, 3, 4, 1, 2] are packed into boxes of capacity 5 by first-fit decreasing. How many boxes are used?
- For an array of length 5 indexed 0 to 4, how many contiguous subarrays contain index 2?
- Among integers from 1 to 40 inclusive, which value has the largest number of 1-bits in binary? Report the smallest such value.
- How many index pairs i < j of [1, 2, 3, 4, 6, 6] satisfy a[i] a[j] = a[i] + a[j]?
- How many distinct values v occur in [5, 1, 2, 3, 9, 10, 4] such that v + 1 also occurs in the array?