Premski - Puzzle Cornerhttp://www.premski.com/puzzlesComputer Science Interview Questionsen-uspcj_1 at yahoo dot com2008-10-02 08:08:422008-10-02 08:08:42Triangle area mismatch problemhttp://premski.com/page_gen.php?id=7deab794e80cb3907e735546de87dd94&lt;img src=\\&quot;http://premski.com/images/premski_puzzle_images/triangle_problem.jpg\\&quot;&gt;&lt;/img&gt;&lt;br&gt;\r\n\r\nBoth triangles contain the same pieces, albeit arranged differently. How\r\ncome the upper triangle is larger by one square? Click <a href=http://premski.com/page_gen.php?id=7deab794e80cb3907e735546de87dd94&mode=reply>HERE</a> to answer this question!2008-10-02 08:08:42Find smallest primeshttp://premski.com/page_gen.php?id=c7c8cd3bbcd711d359ac5addca7c6620how will u find 5 smallest primes in an array having billions of element??(efficient solution required) Click <a href=http://premski.com/page_gen.php?id=c7c8cd3bbcd711d359ac5addca7c6620&mode=reply>HERE</a> to answer this question!2008-09-11 11:29:58Minimal vertex sethttp://premski.com/page_gen.php?id=206c30e0ff88526e7ac17426e9310073Given a graph (any type - Directed acyclic graph or undirected graphs with loops), find a minimal set of vertices which affect all the edges of the graph.\r\n\r\nAn edge is affected if the edge is either originating or terminating from that vertex. Click <a href=http://premski.com/page_gen.php?id=206c30e0ff88526e7ac17426e9310073&mode=reply>HERE</a> to answer this question!2008-09-08 19:40:44Sum of the most common element in an arrayhttp://premski.com/page_gen.php?id=8935c7676b44a527a03b1fb8a7e0aabdFind the sum of the most common element in an array.\r\nExample:\r\n A[]={12,23,24,89,78,76,24}\r\n OutPut:48 Click <a href=http://premski.com/page_gen.php?id=8935c7676b44a527a03b1fb8a7e0aabd&mode=reply>HERE</a> to answer this question!2008-09-08 19:39:30http://premski.com/page_gen.php?id=d0df8e6d19f689f31e6bff524696c7d3You have 8*8 square grid with left-bottom and right-top squares removed. (thus there are only 62 squares remaining in the grid). You are given 31 tiles each of 2*1. You have to put the tiles on the grid without breaking any of the tiles (so that all squares of the grid are covered). How will you do that?\r\nHint: It is impossible to do that, prove :)\r\n\r\nGeneralize the result for 2n*2n grid. What is the case with (2n+1)*(2n+1) grid and (2n)*(2m+1) grid? Click <a href=http://premski.com/page_gen.php?id=d0df8e6d19f689f31e6bff524696c7d3&mode=reply>HERE</a> to answer this question!2008-07-15 14:19:35Triangle 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:02