Skip to content

Instantly share code, notes, and snippets.

@venelrene
Created February 21, 2019 19:52
Show Gist options
  • Select an option

  • Save venelrene/dbdaa50211d078563aba3b72ac133086 to your computer and use it in GitHub Desktop.

Select an option

Save venelrene/dbdaa50211d078563aba3b72ac133086 to your computer and use it in GitHub Desktop.
You live in the city of Cartesia where all roads are laid out in a perfect grid. You arrived ten minutes too early to an appointment, so you decided to take the opportunity to go for a short walk. The city provides its citizens with a Walk Generating App on their phones -- everytime you press the button it sends you an array of one-letter string…
def isValidWalk(walk)
walk.count == 10 && walk.count('n') == walk.count('s') && walk.count('e') == walk.count('w')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment