Questions d'entretien

Entretien pour Software Engineer II

-Bangalore

Given an large list of unsorted numbers, find the smallest number. You can access the list only 3 numbers at a time, and keep moving forward 1 number at a time.

Répondre

Réponses aux questions d'entretien

6 réponse(s)

15

Otherwise called the sliding window problem

Utilisateur anonyme le

1

You can access the list only 3 numbers at a time: It tells we can read three numbers one after other in N/3 Iterations. So Time complexity will be O(N/3)

Utilisateur anonyme le

0

This is sliding window problem and priority queue DS can be used to solve this.

Harsha Jayaramachar le

1

Use the selection sort and after the pass stop the iterating. Time complexity will be O(N) & only one swap.

Vasant le

0

Use the selection sort and after the first pass stop the iterating. Time complexity will be O(N) & only one swap.

Vasant le

1

Did they asked to write the code of the solution? or just pseudo code.And did they added any constraints? Otherwise this is pretty straight forward problem using Insertion sort.

Rishi le

Ajouter des réponses ou des commentaires

Pour commenter ceci, connectez-vous ou inscrivez-vous.