33. Search in Rotated Sorted Array 📄 Problem Statement : There is an integer array nums sorted in ascending order (with distinct values). Before being passed to your function, nums may be rotated at an unknown pivot index k (where 1 <= k < nums.length ) such that the array becomes [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] . You are given the array nums after the rotation and an integer target . Your task is to return the index of the target if it exists in nums , or return -1 if it does not exist. You must solve it in O(log n) time. 📚 Examples : Example 1 : Input: nums = [4,5,6,7,0,1,2], target = 0 Output: 4 Example 2 : Input: nums = [4,5,6,7,0,1,2], target = 3 Output: -1 Example 3 : Input: nums = [1], target = 0 Output: -1 📜 Constraints : 1 <= nums.length <= 5000 -10⁴ <= nums[i] <= 10⁴ All values of nums are unique . nums is a sorted array, possibly rotated . -10⁴ <= target <= 10⁴ ...
Hello everyone i'm Sandip Mali, from Nepal. presently i'm in India, pursuing BTech in cse. I am 19 time's old. My birthday is on September 23rd. My hobbies are playing basketball, video making and editing, writing at last but not least reading. I'm running a YouTube channel about vlogs called " Dim Vlog " you can have a look also their. |
Youtube channel link is here :-
YouTube channel
So at now you get a mixed content then but not you'll get a genuine and self help blogs, thats helps you to know the thing. I'm trying to give you a helpful content. That is helps you to make your life little bit easier.
In this blog i certainly mentioned that you get a content like
1) Self help
2) Money- making ideas
3) how to blogs and
4) self growth
Hope you like this blog and do not forget to follow then.
Thanks for reading and plz share this blog
Comments
Post a Comment
If you have any suggestions then comment me .