Tuesday, January 28, 2014

How to prepare for an interview - 5

This is the fifth post in How to prepare for an interview series. If you didn't read the previous post please read it here.

Remember you should discuss these solutions with me, and refer if there are mistakes or other good solutions.


43. There are three ants on different vertices of a triangle. What is the probability of collision (between any two or all of them) if they start walking on the sides of the triangle? Similarly find the probability of collision with ‘n’ ants on an ‘n’ vertex polygon

44. Given two lines on a Cartesian plane, determine whether the two lines would intersect.

45. Write a method to implement *, - , / operations You should use only the + operator.

46. Given two squares on a two dimensional plane, find a line that would cut these two squares in half.

47. Given a two dimensional graph with points on it, find a line which passes the most number of points.

48. Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7.

49. Methods of a binary search tree.

50. Program an iterator for a Linked List which may include nodes which are nested within other nodes. i.e. (1)->(2)->(3(4))->((5)(6). Iterator returns 1->2->3->4->5->6.

51. Implement an algorithm to convert an integer into a roman numeral string.

Now we finished today's set of problems, Read the next post. Please if you liked the post share it on Facebook, Twitter, Linkedin.

No comments:

Post a Comment