Pattern Program Java Leetcode Problems Sql Server