Ad
  • Custom User Avatar

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

  • Custom User Avatar

    While this adds properties to the nodes, if this is okay, then this will find the loop length in O(k+n) (worst-case) time, where k = <tail_length> && n = <loop_length>. If the <tail_length> is zero, then we're presented with the best-case. Removing the leading constant k, we get O(n) time complexity. If adding properties to the nodes is not permitted, then we would need to iterate back and remove the added properties, leaving us with a time complexity of O(2k + 2n) (worst-case). Remove the leading constant k (<tail_length> of zero) and we're presented with the best-case of O(2n).

    Discaimer: Still pretty new to analyzing computational algorithms so please correct me if I'm wrong here. Also, I welcome any criticism of my approach to the problem.

    Thanks all :-)

  • Custom User Avatar

    Accounts for missing tests long > 180 and long < -180

  • Custom User Avatar

    lol, just realized this kata doesn't test for longitude coords > 180 or < -180. This solution is incorrect.