Search in Rotated Sorted Array I
Learning 1D Array Binary Search DSA practice problem on Onlearn.
Difficulty: medium.
Topics: Search for a target in a rotated sorted array, Arrays, Linear Search, Binary Search, Time Complexity, Space Complexity, complexity analysis, array properties, array manipulation, divide and conquer, search algorithms, binary search, Array Rotation, Sorted & Rotated Arrays.
Given an integer array arr of size N, sorted in ascending order (with distinct values). This array is then rotated at some unknown pivot point. Your task is to find the index at which a given target value k is present. If k is not found in the array, return 1. Input Specification: An integer array arr. An integer k, the target value. Output Specification: Return the 0 based index of k if it is present in arr. If k is not present, return 1. Example 1: Example 2: