Ad
  • Default User Avatar

    I like this solution much better than the ones up top.
    The regexp here is much more readable, you don't have to spend so much time devising it. The trick is to change the order - first split then validate with regexp, not the other way around like I and the author of the current top solution have done. Don't even get me started on 'regexp only' solutions.
    This solution taught me to look more closely into the data that I get on the input rather than jumping into the implementation of the idea that I get by first looking at the problem.
    You don't need to look for the coordinates in a string, the string really consists only of supposed coordinates. You can split them up and validate individually just like it is done here. This is the best way to approach the problem in my opinion.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution