Question d’entretien chez Two Sigma

some bfs dfs question with math and binary search