Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Great kata! A lot of fun figuring out several differnt ways to optimize, and more fun debugging the optimizations. :-)

  • Custom User Avatar

    Instructions should say the count column should be labled 'total_people'.
    Also, I think it would be better to specify an order by. Shouldn't rely on SQL always returning the same row order for an unordered query.

  • Custom User Avatar

    My solution uses this "winding" technique. Imagine standing at the point in question. Face the first vertex, then turn to face each of the other vertexes in sequence, and finally back to the first vertex. If you made a net 360 degree turn, you're inside. If you're outside the net turn is zero. BTW, I never heard of "winding number" when I came up with this solution.

    I also thought of counting intersections on lines from the point to each vertex with each line of the polygon but that seemed harder, and I think it would be slower.