Archive for 2010 - Page 5

  1. Select second largest value in a column using SQL

    The answer is pretty simple without jumping over hoops or thinking about taking MAX etc. SELECT value FROM table ORDER BY value DESC LIMIT 1,1

    Why LIMIT 1,1 ? Shouldnt it be 2,1

    Think again. LIMIT 0,1 is the first record. read on

  2. Find the number of zero's in 'Factorial of a number' N factorial

    For n as the number,

    round(n/5) + round(n/25) + round(n/125)+.......+round(n/5^n)

    etc till the reminder is 0.

    Explain how?

    A zero is formed when a 5 and 2 get multiplied, therefore finding the number of 5's would be enough to find the number of 10's since … read on

  3. 10 cricket balls one is heavier or lighter. Find the ball in 3 weighing chances.

    Lets name the balls 0 1 2 3 4 5 6 7 8 9 for convinience. Step 1 : Take 3 balls from this set lets take 0 1 2 and weigh it against 3 4 5. Weighing 1. Step 1.1 : Now suppose … read on

  4. Measure 4 litre of water using a 3 litre jar and a 5 litre jar

    Solution 1

    1. Fill the 3 liter jar and pour it into the 5 liter jar.
    2. Do it again,
    3. Now in the 3 liter jar you will be left with one litre.
    4. Throw away the 5 liter jar water.
    5. Pour the one litre it into 5 …
    read on

Tags
On Facebook
Email Newsletter