Question d’entretien chez ByteDance

Two coding questions, one easy and one medium