Frage im Vorstellungsgespräch bei Carousell

two coding question to demonstrate some sorting algorithm and find optimal solution