Google Interview Question

some algorithm problems (leetcode medium)