© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
C
C#
•
3y ago
•
2 replies
morry329#
✅ why is it '1' instead of '0'??
So I am analysing this solution
https://leetcode.com/problems/number-of-islands/solutions/3585795/c-flood-fill-solution-beats-90-easy-to-understand-clean/?envType=study-plan&envId=level-1&plan=leetcode-75
Just one block of code puts me off very much
:
if(grid[x][y] == '1'){
grid[x][y] = '0';
}
if(grid[x][y] == '1'){
grid[x][y] = '0';
}
`
Why is the code like this
, if the grid is painted
'1
' then the grid turns
'0
'
? I tried to play around with this block for understanding it
(swap
'0
' and
'1
' or set both of the chars to
'1
'
'1
' etc
)
, my try led to stack overflow
.
LeetCode
C#| Flood fill solution, beats 90%, Easy to understand, clean. - Nu...
View shayke223
's solution of Number of Islands on LeetCode
, the world
's largest programming community
.
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
❔ ✅ why properties instead of public fields
C
C# / help
3y ago
Needing help on why it always does 60 instead of 120.
C
C# / help
2y ago
Why does Task 1 prints first instead of Task 3 - Async & Await
C
C# / help
2y ago
Why use `await AbcAsync()` instead of `Abc()`
C
C# / help
9mo ago