Question d’entretien chez Uber

Search a target number in a Rotated Sorted Array.

Réponses aux questions d'entretien

Utilisateur anonyme

4 avr. 2016

public int search(int[] nums, int target) { int start = 0; int end = nums.length - 1; while (start = nums[start]) { end = mid - 1; } else { start = mid + 1; } } else { //5 6 7 1 2 3 4, 6 if (target > nums[mid] && target <= nums[end]) { start = mid + 1; } else { // end = mid - 1; } } } return -1; }

1

Utilisateur anonyme

27 oct. 2015

Binary search

Utilisateur anonyme

10 déc. 2015

I would like to slap your interviewer for asking this question in an interview: "How do you calculate PI, if I just give you a calculator." Definitely he/she don't know what is "problem solving" in software engineering. Btw, I work for Amazon.

Utilisateur anonyme

10 févr. 2016

To answer the Pi question- I will first turn the calculator on, press 22, then press '/', then 7, then '='. Then I will test for edge cases where calculator's buttons may not have been pressed properly. -_-

1