Book of programming problems

Contains advanced programming problems for schools, colleges and problem-hungry inidividuals

Find unpaired numbers fast and without allocating memory
Complexity (1-100): 45
A potentially large array of N integers is given.
  1. It is known that all but one array elements have paired elements (therefore the array size is odd). Find the value of that unpaired element.
  2. It is known that all but two array elements have paired elements (therefore the array size is even). Find the value of those unpaired two elements.
You are allowed to spend o(N) time and allocate o(1) amount of memory.
Solution:Show/hide explanation |
There are no posts in this topic.

Post Reply

Book of programming problems is powered by UseBB 1 Forum Software | Contact Admin