Stack Overflow: Challenge #14 Signal from Noise
stackoverflow.com·1d·
Discuss: Hacker News
🔐Cryptography
Preview
Report Post

For this challenge you will be given a list of integers that is supposed to form a continuous range from A to B, but:

A and B are unknown.

Exactly one integer is missing from within the sequence.

Exactly one integer appears twice.

The array may contain extra random noise values outside the range. (It is possible that the noise values could form a mini-sequence, but the noise sequence will be shorter than the primary sequence)

The challenge is to determine the start value, end value, missing value and duplicate value.

Here are some examples:

Example 1:

[5, 9, 7, 6, 7, 4, 100, -2]

Start value: 4

End value: 9

Missing value: 8

Duplicate value: 7

Noise: -2, 100

Example 2:

[4, 5, 6, -1, 8, 8, -2, -3, -2]

Start value: 4

End value: 8

Missing value: 7

Duplicat…

Similar Posts

Loading similar posts...