[Community Puzzle] A mountain of a mole hill

All test cases and validators share an unstated constraint that all fences are close-ended. Shall I add that as a constraint or do you have any other suggestions?

I disagree. This IS an “easy” challenge, but it does still require a little thinking.

Flood fills are slow and unnecessary, but fun.

Remember that everything outside of the grid is also “outside” of the garden. So, as you read the line from left to right, what conditions make you become INSIDE the garden? Passing some vertical fencing ’ | ’ of some kind, yes? What happens if you pass a second vertical fence? a third? a fourth?

Identifying vertical fencing can be done per line - as they are read from the input.

Consider what horizontal fence sections ‘±----+’ actually mean … how you understand these is important. Sometimes they mark a boundary between the inside and the outside… sometimes they don’t. When do they behave like vertical fences? ; )

Time spent away from the computer, thinking about how the problem can be simplified… and perhaps doodling some fences on a napkin… almost always pays off in faster, simpler and more efficient code ; )

Great puzzle I had a lot of fun, tyvm!

I agree actually, I mean i solved it but it shouldn’t be “easy”,“medium” would do better

1 Like

yeah this is three years old, but I had been coming back and forth from this puzzle for months and this hint finally made it click for me. Which is crazy because of how many other puzzles I had solved by adding a layer of padding around the “image.” Thanks for the hint.

1 Like