Okta interview question

Leetcode mid and leetcode hard