LeetCode 2729: Fascinating checking if the number