Java 2d Array Hackerrank Solution For Python