Current Interview Question

leetcode question. normal question for finance companies