Premski - Puzzle Cornerhttp://www.premski.com/puzzlesComputer Science Interview Questionsen-uspcj_1 at yahoo dot com2008-06-24 23:31:302008-06-24 23:31:30Triangle problemhttp://premski.com/page_gen.php?id=ab85f9339465df931d8d268a902eb055given a triangle ABC, how would you use only a compass and a straight edge to find a point P such that triangles ABP, ACP &amp; BCP have equal perimeters?(Assume that ABC is constructed so that a solution does exist) Click <a href=http://premski.com/page_gen.php?id=ab85f9339465df931d8d268a902eb055&mode=reply>HERE</a> to answer this question!2008-06-24 23:31:30http://premski.com/page_gen.php?id=acf6ce3d7891d1ea068add6e1483fb8f#\r\n\r\nSay we have a data structure as follows:\r\n\r\nenum {RED,BLUE,GREEN};\r\nstruct Ball\r\n{\r\n /*...*/\r\n int color;\r\n};\r\n\r\nint ColorOfBall(Ball b)\r\n{\r\n return b.color;\r\n}\r\nBall arr[SIZE];\r\n\r\nThe array arr consists of balls of with one of the three colours\r\n(Red,Green,Blue). Now we need to sort the array in such a way that all\r\nthe Red coloured balls come first, followed by blue and then green.\r\n\r\nThe restriction is that call to function ColorOfBall is a very costly\r\noperation. You have to use it as less as possible. (In other words we\r\nwould be looking for the solution with least number of calls to the\r\nfunction ColorOfBall.)\r\n Click <a href=http://premski.com/page_gen.php?id=acf6ce3d7891d1ea068add6e1483fb8f&mode=reply>HERE</a> to answer this question!2008-06-24 23:28:10Multiplication of numbershttp://premski.com/page_gen.php?id=009a21d9b328f3a1bc38f7e0e1aa1a1fThere is an array A[N] of N numbers. You have to compose an array Output[N] such that Output[i] will be equal to multiplication of all the elements of A[N] except A[i]. For example Output[0] will be multiplication of A[1] to A[N-1] and Output[1] will be multiplication of A[0] and from A[2] to A[N-1].\r\n\r\nSolve it without division operator and in O(n). Click <a href=http://premski.com/page_gen.php?id=009a21d9b328f3a1bc38f7e0e1aa1a1f&mode=reply>HERE</a> to answer this question!2008-06-16 04:56:01Probability to spot a carhttp://premski.com/page_gen.php?id=5c0158f6c04c5a8216e26357a7699fadIf the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes Click <a href=http://premski.com/page_gen.php?id=5c0158f6c04c5a8216e26357a7699fad&mode=reply>HERE</a> to answer this question!2008-06-16 04:16:49Preorder traversalhttp://premski.com/page_gen.php?id=6093cd60c3eb12e08b134306c7eddbbdWrite a c code (both recursive &amp; non recursive) to do preorder traversal\r\nof a binary tree Click <a href=http://premski.com/page_gen.php?id=6093cd60c3eb12e08b134306c7eddbbd&mode=reply>HERE</a> to answer this question!2008-04-04 00:38:02Minimum possible raceshttp://premski.com/page_gen.php?id=74e2805d8d67fb03d7258c6ec6d483c2There are 25 horses and 5 lanes. You have no idea about which horse is better than other. Find in minimum possible races, the first three fastest running horses. Click <a href=http://premski.com/page_gen.php?id=74e2805d8d67fb03d7258c6ec6d483c2&mode=reply>HERE</a> to answer this question!2008-03-14 11:29:29What is the age of my children?http://premski.com/page_gen.php?id=3ab6ba760bef477b9ab16e64a8e962e1Mr. X meet Mr. Y during an early morning walk.\r\n\r\nMr Y asks the age of Mr. X\\\'s children and Mr. X is a math professor so gives Mr Y a problem to solve.\r\n\r\nMr X says \r\n-&gt; I have 3 children \r\n-&gt; The product of their ages is 36\r\n-&gt; The sum of their age is equal to the number of houses in my street.\r\n-&gt; And my first daughter has blue eyes.\r\n\r\nUsing these clues Mr Y was able to say the ages of the 3 children. Click <a href=http://premski.com/page_gen.php?id=3ab6ba760bef477b9ab16e64a8e962e1&mode=reply>HERE</a> to answer this question!2008-03-13 18:29:30Lucky Vs Unlucky Numberhttp://premski.com/page_gen.php?id=fdc7485d94544035d4678f26361b64a2In Russia you get into a bus, take a ticket, and sometimes say : Wow, a lucky number! Bus tickets are numbered by 6-digit numbers, and a lucky ticket has the sum of 3 first digits being equal to the sum of 3 last digits. When we were in high school (guys from math school No. 7 might remember that ) we had to write a code that prints out all the lucky tickets\\\' numbers; at least I did, to show my loyalty to the progammers\\\' clan. Now, if you add up all the lucky tickets\\\' numbers you will find out that 13 (the most unlucky number) is a divisor of the result. Can you prove it (without writing a code)? Click <a href=http://premski.com/page_gen.php?id=fdc7485d94544035d4678f26361b64a2&mode=reply>HERE</a> to answer this question!2008-03-13 18:28:26Bank card fraudhttp://premski.com/page_gen.php?id=7188c47f4f93a43d703b50654606d184A bank has a collection of n bank cards that they&acirc;€™ve confiscated, suspecting them of being used in a fraud. Each bank card corresponds to a unique account in the bank. Each account can have many cards corresponding to it, and we&acirc;€™ll say that two bank cards are equivalent if they correspond to the same account. The only way to say 2 cards are equivalent is by using a high-tech &acirc;€œequivalence-tester&acirc;€¯ that takes in 2 cards, and after performing some computations, determines whether they are equivalent. \r\n\r\nTheir question is the following: among the collection of n cards, is there a set of more than n/2 of them that are all equivalent to one another? Assume that the only feasible operations you can do with the cards are to pick two of them and plug them in to the equivalence tester. Answer in O(n) Click <a href=http://premski.com/page_gen.php?id=7188c47f4f93a43d703b50654606d184&mode=reply>HERE</a> to answer this question!2007-11-03 05:31:52A google puzzlehttp://premski.com/page_gen.php?id=d1a78fb58ce8a3a1276a0f543a13bf59Not sure if this really is a valid puzzle, but WTH, one of you smart guys might find something after all. Enjoy!\r\n\r\n&lt;img src=\\&quot;http://blogoscoped.com/files/google-riddle-2007-10.png\\&quot; alt=\\&quot;\\&quot; style=\\&quot;width: 500px; height: 300px;\\&quot;&gt;&lt;/img&gt; Click <a href=http://premski.com/page_gen.php?id=d1a78fb58ce8a3a1276a0f543a13bf59&mode=reply>HERE</a> to answer this question!2007-10-29 03:31:00