Pattern Program Java Leetcode Questions