+ 1

Continuous problem

I have a continuous problem when i comes to coding competitions. And that issue is i am having a tough time reading problem statements. I have stated this before but i am still having a tough time reading them and making sense of what the question is asking for example: Difficulty: Hard In a 2D grid of 0s and 1s, we change at most one 0 to a 1. After, what is the size of the largest island? (An island is a 4-directionally connected group of 1s). Example 1: Input: [[1, 0], [0, 1]] Output: 3 Explanation: Change one 0 to 1 and connect two 1s, then we get an island with area = 3. Example 2: Input: [[1, 1], [1, 0]] Output: 4 Explanation: Change the 0 to 1 and make the island bigger, only one island with area = 1. Example 3: Input: [[1, 1], [1, 1]] Output: 4 Explanation: Can't change any 0 to 1, only one island with area = 1. Notes: 1 <= grid.length = grid[0].length <= 50. 0 <= grid[i][j] <= 1. When i read this i have a tough time understanding it this from from one of the other sites i compete at. I could not solve it in time before the contest ended how do you read this and take the steps necessary to solve it. Sometimes i feel so dumb i should know how to read and solve this.

29th Apr 2018, 3:56 AM
Anthony Perez
0 Réponse