Back to problems

Single Element in a Sorted Array

Algorithm · Amazon · Medium

Single Element in a Sorted Array Medium · Topics · Company Tags · Hints You are provided with a sorted (non‑decreasing) integer sequence arr that has an odd number of elements. Within this sequence, every integer occurs exactly two times, except for one value that appears only once. Your task is to identify and return this unique number. Your solution must run in O(log n) time and must use at most O(1) additional memory beyond the input. Input The first line contains an…

Checking your access…