Data Structures & AlgorithmsHardTCS NQT · Accenture

From the list 1 to 12, every node whose value is a perfect square (1, 4, 9) is deleted. What is the sum of the remaining values?

  1. A. 64
  2. B. 65
  3. C. 66
  4. D. 68

Correct answer: A. 64

The total of 1 to 12 is 78; removing 1, 4 and 9 (sum 14) leaves 64, not 65. Forgetting that 1 is a square is the usual slip.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic