SoftwareOne Interview Question

2 medium level exercises on leetcode