Data Structures & AlgorithmsHardTCS NQT · Infosys
A list holds 1 to 10. Every node whose 1-based position is a multiple of 3 is deleted. What is the sum of the remaining values?
- A. 38
- B. 39
- C. 37
- D. 41
Correct answer: C. 37
The deleted values are 3, 6 and 9 (sum 18). The total of 1 to 10 is 55, leaving 37.
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 unordered index pairs i < j in [2, 3, 4, 5, 6] have a[i] + a[j] prime?
- How many distinct anagram classes are there among the words eat, tea, tan, ate, nat and bat (two words are in the same class if one is a…
- How many values x in [2, 4, 6, 7, 8] have both x - 1 and x + 1 present in the array?
- What is the length of the longest palindromic subsequence of the string agbdba?
- How many substrings of abbaba contain an equal number of letters a and b (substrings of length at least 2)?
- Given the words ba, b and a, concatenate all three in some order. What is the lexicographically smallest resulting string?