Citi Interview Question

Easy and medium leetcode question