Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 B
How many index pairs i < j in [3, 4, 2, 6, 1, 2, 12, 1] have a[i] * a[j] = 12?
- A. 6
- B. 5
- C. 7
- D. 9
Correct answer: B. 5
The product 12 arises from 3 * 4 (once), 2 * 6 (twice, using the two 2s) and 1 * 12 (twice, using the two 1s), giving 5 position pairs.
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 distinct strings of length 3 are palindromes that occur as subsequences of abcab (of the form x y x with y different from x)?
- What is the length of the longest palindromic subsequence of the string leetcode?
- How many contiguous non-empty substrings of aaabbbaa consist of a single repeated letter?
- What is the sum of the distinct prime divisors of 2310?
- How many positive divisors does 2^5 3^3 5^2 have?
- How many integers x in [1, 200] are divisible by 4 but not by 6?