Pattern Program In Leetcode Python