LeetCode 33 | Search in Rotated Sorted Array | Algorithm Explained (Java)

Pubblicato il: 16 marzo 2020
sul canale di: Xavier Elon
361
11

The description reads:
"Given an integer array nums sorted in ascending order, and an integer target.

Suppose that nums is rotated at some pivot unknown to you beforehand (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).

You should search for target in nums and if you found return its index, otherwise return -1.



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"

Github: https://github.com/xavierelon1
Github HackerRank Solutions: https://github.com/XavierElon1/Hacker...
Github Leetcode Solutions: https://github.com/XavierElon1/LeetCo...
Facebook:   / xavier.hollingsworth.3  
Instagram:   / xavierelon  
LinkedIn:   / xavier-hollingsworth-524144127  
Twitter:   / elon_xavier  


In questa pagina del sito puoi guardare il video online LeetCode 33 | Search in Rotated Sorted Array | Algorithm Explained (Java) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Xavier Elon 16 marzo 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 361 volte e gli è piaciuto 11 spettatori. Buona visione!