Asked inAmazon,Intern

You are given a sorted array that has been rotated at some pivot unknown to you. You are also given a target value to search for in the array. Implement an algorithm to find the index of the target value in the rotated array. If the target value is not found, return -1.

AnswerBot
2y

Search a number in sorted rotated array.

  • Use binary search to find the pivot point where the array is rotated

  • Determine which half of the array the target number may be in

  • Perform binary search on the ap...read more

Anonymous
1y

Use binary search to find the pivot point where the array is rotated

Determine which half of the array the target number may be in

Perform binary search on the appropriate half of the array to find the ...read more

Anonymous
1y

Use binary search to find the pivot point where the array is rotated

Determine which half of the array the target number may be in

Perform binary search on the appropriate half of the array to find the ...read more

Kasthuri
2y
    Use binary search to find the pivot point where the array is rotatedDetermine which half of the array the target number may be inPerform binary search on the appropriate half of the array to find the ...read more
Niranjan Malik
3y

An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Devise a way to find an element in the rotated array in O(log n) time

Select
Add answer anonymously...

Amazon Intern interview questions & answers

An Intern was asked 2mo agoQ. Describe a graph-related LeetCode question that can be solved using recursion.
An Intern was asked 8mo agoQ. Explain your approach to time management.
An Intern was asked 8mo agoQ. What was your percentage score?

Popular interview questions of Intern

An Intern was asked 2mo agoQ1. Describe a graph-related LeetCode question that can be solved using recursion.
An Intern was asked 9mo agoQ2. Explain your approach to time management.
An Intern was asked 9mo agoQ3. What was your percentage score?
Amazon Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits