UBS Interview Question

A leetcode medium done on Google sheets