ISDC Interview Question

2 simple algorithmic questions