Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 577 Bytes

File metadata and controls

14 lines (11 loc) · 577 Bytes

Problem 5: Search in Disrupted Continuum

Problem Statement

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). 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.

Input Format

  • A rotated sorted array nums.
  • An integer target.

Example

Input: nums = [4, 5, 6, 7, 0, 1, 2], target = 0
Output: 4