Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

You are given a sorted array * ‘arr’* of

Return the number that appears once.

```
Input: 'arr' = [1,1,2,2,4,5,5]
Output: 4
Explanation:
Number 4 only appears once the array.
```

```
Exactly one number in the array 'arr' appears once.
```

Detailed explanation

```
5
1 1 3 5 5
```

```
3
```

```
Given array is [1, 1, 3, 5, 5]
Here, 3 occurs once in the array. So, the answer is 3.
```

```
5
1 1 4 4 15
```

```
15
```

```
The array is [1, 1, 4, 4, 15].
Here, 15 occurs once in the array. So, the answer is 15.
```

```
Try to solve this in O(log(n)).
```

```
1 <= n <= 10^5
0 <= arr[i] <= 10^9
Time Limit: 1 sec
```