Bitcoin.com interview question

Coding Challenge question on leetcode