Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day 18 q2: Search in Rotated Sorted Array #409

Open
sumiranverma opened this issue Jan 14, 2024 · 11 comments
Open

Day 18 q2: Search in Rotated Sorted Array #409

sumiranverma opened this issue Jan 14, 2024 · 11 comments
Assignees

Comments

@sumiranverma
Copy link
Contributor

There is an integer array nums sorted in ascending order (with distinct values).

Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed).
For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].

Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums,
or -1 if it is not in nums.

You must write an algorithm with O(log n) runtime complexity.

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^4 <= nums[i] <= 10^4
  • All values of nums are unique.
  • nums is an ascending array that is possibly rotated.
  • -10^4 <= target <= 10^4

question link: https://leetcode.com/problems/search-in-rotated-sorted-array/

@namita0210
Copy link
Contributor

namita0210 commented Jan 15, 2024

Pls assign this issue to me @sumiranverma @karishma-2020

@Tech-neophyte
Copy link
Contributor

Please assign this to me @bh-g @kratika-Jangid

@Shubh-Krishna
Copy link
Contributor

please assign this question to me :) @bh-g

@avanimathur
Copy link
Contributor

Please assign it to me @bh-g @kratika-Jangid @karishma-2020

@Karnankita04
Copy link
Contributor

@bh-g please assign this issue too me :)

@Anomasingh
Copy link
Contributor

Anomasingh commented Jan 16, 2024

please assign this issue to me....

@priyagupta20044
Copy link
Contributor

Please assign this to me @bh-g @kratika-Jangid

@Karnankita04
Copy link
Contributor

Karnankita04 commented Jan 20, 2024

@bh-g please review my PR

@Anomasingh
Copy link
Contributor

Please Merge my PR..

bh-g added a commit that referenced this issue Jan 22, 2024
Solved Day 18 q2: Search in Rotated Sorted Array #409
@Karnankita04
Copy link
Contributor

@bh-g please assign this issue to me, I want to use another approach to solve this question :)

@sriya-singh
Copy link

@bh-g @kratika-Jangid @karishma-2020 please assign this issue to me. I have a better approach to solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants