We pay for user submitted tutorials and articles that we publish. Anyone can send in a contributionLearn More
This is the fifteen post of the series of programming job interview challenge, 37 readers provided an answer to job interview challenge #14. As you can understand from the title, I have a little announcement to make, but lets first head on to last weeks question answers.
This time, Omar was the first one to provide an efficient and correct detailed answer:
Draw a line from the single point (any direction will do).
Count the number of times that this line intersects with lines of the polygon.
An even count (including zero) indicates that the point is outside of the polygon.
An odd count indicates that the point is inside the polygon.
Here is a nice image taken from Jon von Gillern blog post http://www.vonsharp.net/ProgrammingJobInterviewChallengeAnswerWeek14.aspx:
Those are the other blog entries with answers to last weeks question:
Those are the other reader who provided correct, simple and efficient answers: Michael Mrozek, Jonathan Starr, Mark R, Michael Russell, redge, Tim Kington, Gabriele Cannata, Alex (one line would be enough), Stefan M, Niki, Marc Melvin, Ian Qvist, Kimmen and Valera KOlupaev.
Some readers provided correct answers which are less simple or efficient: David, Tristan, Joost Morsink, Andrew, Erik and Shams Mahmood.
This Week Question:
I think that this is the end of our series. I have no questions left in the bank… I have many design questions, which are best for job interviews, but I can’t publish those kind of questions because there are many correct answers and not just one or two…
I want to thank all of you who participated in this series, if you have any ideas for new questions and you want them to be published here at www.Dev102.com, don’t hesitate to contact us. Don’t be offended if we don’t publish your question, there are some great questions for real job interviews which does not fit for blog posts.
So, as you can understand, we might have more challenges in the future but the series won’t be weekly anymore. Get updates by RSS to catch up with those future posts and with our other “regular” articles.
Tags :C#challengeconcaveconvexgeometryjob interviewpointpolygonprogrammingquestionSoftwarethe end
Copyright © 2012 Dev102.com
Breeze : Designed by Amit Raz and Nitzan Kupererd