Okta Interview Question

It is a LeetCode medium question