Home > other > Breadth-first traversal of the island of related issues, have bosses to come to a train of thought
Breadth-first traversal of the island of related issues, have bosses to come to a train of thought
Time:11-19
Strives for the number of islands and iterate through all the possible problems Problem: given a '1' (land) and '0' (water) n grid (n is odd number), the initial array of array heart place 1 phalanx, n 3, initial island is like this: [[0, 0], [0, 0], [0, 0]] Because of reclaiming land from the sea, coastal island radiation around the island, island only require new radiation and neighbouring island before, and so on, That is to say, [[0,1,1], [0, 0], [0, 0]] this island is in conformity with the rules, The [[0, 1], [0, 0], [0, 1]] is not in conformity with the rules,
If radiation may be suspended at any time, then ask the reclaiming land from the sea how possibility? O bosses give a train of thought