Frage im Vorstellungsgespräch bei SAS

Swap two integers until you cannot.

Antwort im Vorstellungsgespräch

Anonym

10. Okt. 2025

use a for loop and compare the current element to element to right (-1) to avoid out of bounds, and use a while loop to do this to check with a boolean flag. Time Complexity is N ^ 2. I offered to optimize, but the interviewer declined.