Question d’entretien chez IBM

Coding questions from hackerank. two questions based on permutations