Applied Materials Interview Question

A leetcode medium question in the take home assessment