passed hackerrank_Lego_Blocks.java