Everpure Interview Question

2 leetcode problems pretty straightforward