Data Structures & AlgorithmsHardGATE CS · TCS NQT
How many distinct values appear among the XORs of all non-empty contiguous subarrays of [1, 2, 3]?
- A. 5
- B. 6
- C. 4
- D. 8
Correct answer: C. 4
The subarray XORs are 1, 2, 3, 3, 1, 0; the distinct values are 0, 1, 2 and 3.
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 windows of length 3 in the string abaaabaa are anagrams of aab (same letters with the same counts)?
- What is the length of the longest substring of aabaaccaa that contains at most two letters 'a'?
- How many palindromic substrings (counted by position) does the string abbaabba contain?
- How many distinct palindromic substrings does the string aabaa contain?
- What is the smallest integer x greater than 100 with x congruent to 3 modulo 7 and x congruent to 5 modulo 11?
- How many integers in [1, 200] are coprime to 210?