HHH Interview Question

Write a logic for sorting an array