Pattern Program In Leetcode 1508