Solve array-sum and city-community problems | Google Coding Question