Data Structures & AlgorithmsModerateTCS NQT · Accenture
An array has values [1, 1, 1, 2, 2, 3, 4, 4, 4, 4, 5]. Every value that occurs more than twice is removed entirely. How many elements remain?
- A. 5
- B. 6
- C. 4
- D. 8
Correct answer: C. 4
Values 1 and 4 occur more than twice and are removed. The remaining elements are 2, 2, 3 and 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
- How many index pairs i < j in the sorted array [1, 2, 4, 6, 7, 9] satisfy a[i] + a[j] <= 10?
- What is the value of 7^100 mod 9?
- How many integers x in [1, 100] satisfy that x^2 + x + 41 is divisible by 43?
- Matrices A1 to A6 have dimension sequence p = [30, 35, 15, 5, 10, 20, 25] (matrix i is p[i−1] × p[i]). What is the minimum number of…
- In how many ways can the string "aabaab" be split into one or more contiguous pieces so that every piece is a palindrome? (Each split is…
- A frog starts at position 0 and wants to reach position 12 on a number line. Each move it jumps forward by 1, 3 or 4 units. In how many…