Math, asked by mansijoshi1986, 9 months ago

Given a read only array of n + 1 integers between 1 and n, find one number that repeats in linear time using less than o(n) space and traversing the stream sequentially o(1) times.

Answers

Answered by Anonymous
4

 \large\boxed{\underline{\mathcal{\red{A}\green{n}\pink{s}\orange{w}\blue{e}\red{r:}}}}

Given an array of n elements which contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these repeating numbers in O(n) and using only constant memory space.

For example, let n be 7 and array be {1, 2, 3, 1, 3, 6, 6}, the answer should be 1, 3 and 6.

Answered by Anonymous
1

Answer:

Given an array of n elements which contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these repeating numbers in O(n) and using only constant memory space.

For example, let n be 7 and array be {1, 2, 3, 1, 3, 6, 6}, the answer should be 1, 3 and 6.

Similar questions