Find First and Last Position of Element in Sorted Array | LeetCode 34

Опубликовано: 27 Октябрь 2024
на канале: Shiva Prasad Gurram
51
0

We solved this using Binary Search in O(log n) time complexity. If you have any questions please do let me know.

Basically we need to find first and last indexes of given target in input and return those, else we ca return -1, -1.

Input: nums = [5,7,7,8,8,10], target = 8
Output: [3,4]

Input: nums = [], target = 0
Output: [-1,-1]

#shivaprasadgurram #leetcode #binarysearch #codingchallenge #algorithm #datastructures #programming #problemsolving #leetcodeproblems #learnprogramming #codewithme #techexplained #leetcode #codingtutorials #java #hashmap #bruteforce #problemsolving #codinginterview #datastructures

🔗 Connect with me:
💼 LinkedIn:   / shivaprasadgurram  
📣 Telegram: https://t.me/+764RyZ8uGVw3MzQ1
📧 For business inquiries: [email protected]

Disclaimer/Policy:
----------------------------
Note : All uploaded content in this channel is mine and its not copied from any community.