You are viewing a single comment's thread. Return to all comments →
Python can evaluate strings including numbers and letters
>>> '0'<'1'<'2'<'3'<'4'<'5'<'6'<'7'<'8'<'9'<'X' True
As you iterate through the grid the cavities are marked with the 'X' where all the adjacent cells are less than. For example
'X'
1111 1911 1911 1111
returns with no cavities as 9 and 9 are equal.
9
If we replace with an X it is because the surrounding cells evaluate as less than.
X
So if 9 > 8 so too is X > 8 so the relationship between the cells is maintained and there is no need to check for X
9 > 8
X > 8
Seems like cookies are disabled on this browser, please enable them to open this website
Cavity Map
You are viewing a single comment's thread. Return to all comments →
Python can evaluate strings including numbers and letters
As you iterate through the grid the cavities are marked with the
'X'
where all the adjacent cells are less than. For examplereturns with no cavities as
9
and9
are equal.If we replace with an
X
it is because the surrounding cells evaluate as less than.So if
9 > 8
so too isX > 8
so the relationship between the cells is maintained and there is no need to check forX