Single Element in a Sorted Array | Day 12 | [May LeetCoding Challenge] [Leetcode] [2020] #withMe

preview_player
Показать описание
The day 12 problem in May Leetcoding Challenge. ( Single Element in a Sorted Array ). Asked in google, amazon, Microsoft, Facebook.

Problem statement:
You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. Find this single element that appears only once.

Example 1:
Input: [1,1,2,3,3,4,4,8,8]
Output: 2

Example 2:
Input: [3,3,7,7,10,11,11]
Output: 10

Note: Your solution should run in O(log n) time and O(1) space.

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #softwareengineering #algorithmsMadeEasy
Рекомендации по теме
Комментарии
Автор

I hope you all are enjoying the may leetcoding challenge!!! Don't forget to leave a comment!!! Please like the video to support us!!!
Struggling in a question??
Leave in a comment and we will make a video!!!🙂🙂🙂

AlgorithmsMadeEasy
Автор

What if we use a two pointer approach will it still be O(n)

Ajaysaipotluri
Автор

if you use unordered_map it will be easy
and its TC is 0(logn)

zeeshanhasankhan