Tuesday, March 12, 2013

We're playing a game. Cards numbered from 1-10 are placed in a hat. whatever card is drawn is the paid out amount. how much should i charge you to play this game? If you can redraw by placing the first card back into the hat, what is the new price?


Monday, March 4, 2013

You have N guards in a line each with a demand of coins.You can skip paying a guard only if his demand is lesser than what you have totally paid before reaching him.Find the least number of coins you spend to cross all guards


Monday, January 21, 2013

Find the sum of all the multiples of 3 or 5 below 1 billion.

Since i dont want to stop hacking , i decided to post simple problem to start off the new year , Happy hacking , give its try !!!


PS: 1 billion is big no. its equal to no. of user facebook have ;)

Monday, December 24, 2012

Count maximum number of "connected 1" in given matrix

you have a matrix of N x N filled with 1 or 0. you can move only 1 step either right or 1 step down. you need to count maximum number of "connected 1" in given matrix. for example
0 0 1 1
1 1 1 0
1 0 1 0
0 1 0 1

[Start from top left] maximum no. of 1 is 4
[1,0][1,1][1,2][2,2]


Source -: Commented by a user "rakesh"

Thursday, December 20, 2012

Find the minimal required number of white balls to achieve below criteria

You are given C containers, B black balls and an unlimited number of white balls. You want to distribute balls between the containers in a way that every container contains at least one ball and the probability of selecting a white ball is greater or equal to P percent. The selection is done by randomly picking a container followed by randomly picking a ball from it.

Find the color of the k-th ball (1-index based) that will be destroyed.

Bob is playing with his ball destroyer robot. Initially, Bob has r red balls, g green balls and b blue balls. The robot will repeat the following 3-step program until there are no balls left:

  • If there is at least one red ball available, destroy one red ball.
  • If there is at least one green ball available, destroy one green ball.
  • If there is at least one blue ball available, destroy one blue ball.
You are given the longs r, g and b. You are also given a long k. Find the color of the k-th ball (1-index based) that will be destroyed.
  • If the color of the k-th ball to be destroyed is red, return "RED" (quotes for clarity, returned values are case-sensitive).
  • If the color is green, return "GREEN".
  • If the color is blue, return "BLUE".


Source : Commented by a user named bob , later i found property of TopCoder , so i have am just sharing it to learning purpose , TopCoder Inc. holds all right on the problem statement .