Question d’entretien chez TikTok

Write code to implenment the Sort the flags problem/