Skip to main content

Brave Warrior

Source: Insight (IITB Newsletter) Questech

In a land far away, there is a village threatened by an hundred-headed beast. This beast can only be killed by cutting of all the hundred heads. Legend says that any brave warrior can cut off exactly 10, 20, 30 or 40 heads at one time. However with each of these, 40, 2, 60 and 4 new heads appear respectively.
The village has lost several brave warriors against this beast. Can you save the village from this beast ?

Solution: Solution provided by Bhanu Prakash (M.Tech Student, CSE, IITB) in comments!!


  1. the order in which the warrior should cut the heads.

    10-10=0 and so he is dead..
    I am sure this problem is not that please say me what i am missing

  2. Prove that this is the best you can do. :)

  3. well, i found another one


    The possible number of heads after first try is

    130, 82, 64

    similarly after second try

    160, 112, 94, 46, 28

    Similarly after third try


    and hence the solutions provided are the best possible...:)

  4. @Bhanu.. Thanx for the proof.

    I wrote the solution in dynamic programming form to get the proof.

    best(100)= min{best(130), best(82), best (130), best(64)} + 1 = min{best(82), best (130), best(64)} + 1;

    best(130) >= 4 {as 40*3<130}
    best(82) >= 3 {as 40*2<82}

    best(64)= min{best(94), best(46), best (28)} + 1

    best(94) >= 3 {as 40*2<94}
    best(46) >= 2 {as 40*1<46}
    best(28) >= 2 {as we are anyways not able to do it in 1 chance}

    So, best(64)>= 3;

    So, best(100)>=4;

    Since the solution given by you
    100-20+2 = 82
    82-40+6 = 46
    46-40+4 = 10
    10-10 = 0

    takes 4 steps, it is an optimal solution. You can find different optimal solutions.

    Thanx for the solution and proof.

  5. wont a happy BFS solve it. why DP? makes sense only if u want to solve for any N I guess, but if u want to prove that for 100, 4 is the best then simple BFS tree shud show it i guess?

  6. @Ramdas..
    essentially I am doing the same thing..
    using the explanation by BFS would have been better.. Thanx


Post a Comment

Popular posts from this blog

Asking a girl out

This is not a puzzle. So, for those of you who follow this puzzle blog, please bear with me for just one post. Interesting Math in this article though :P

Most of my friends already read an article that I wrote more than an year back - "Speak Up"

Here, inspired by the movie, The Beautiful Mind, I give a mathematical analysis of asking a girl out. Nice time it is. Feb 10. No plans for Feb 14 and I am sure this article makes me look even more geekier and all the more reason for me to believe that I will be alone, yet again. But what the hell, lets do it!

Note: This is not an independent analysis. There are many "mathematics sites" which does "similar" analysis.

@Consultants, correct me if I am wrong in my estimates. :P

Why is there a need to be selective?

From the age of 15, I guess there are approximately 3,600 girls I have liked (On average days, I don't see new girls. But going outside, I like about 30 girls. Saying that I go out once every week right …

Consecutive Heads

Let's say A keep tossing a fair coin, until he get 2 consecutive heads, define X to be the number of tosses for this process; B keep tossing another fair coin, until he get 3 consecutive heads, define Y to be the number of the tosses for this process.

1) Calculate P{X>Y}
2) What's the expected value of X
3) What's the expected value of Y

This is probably the hardest puzzle I have ever put on my blog. Hence, I will post its solution in the post directly rather than on comment.

(Solved by me finally after 13 months :))

Make a state diagram. Let the state be (a,b) where a is the number of consecutive heads streak "A" is on currently and b is the number of consecutive heads streak "B" is on currently.

So, (0,3) (1,3) are final accepted states and (2,0) (2,1) (2,2) (2,3) are failure states. If you get tails, your contribution to the state reaches to "0"

f(State) = P(X>Y | "State" configuration initially)

f(0,0) = 1/4[f(…

Fraction Brainteaser

Sent to me by Gaurav Sinha

Siddhant writes a Maths test and correctly answers 5 out of 6 Arithmetic questions and 20 out of 28 Geometry questions. In total, Siddhant scores 25 out of 34. 

Vaibhav writes another Maths test and correctly answers 20 out of 25 Arithmetic questions and 6 out of 9 Geometry questions. in total, Vaibhav scores 26 out of 34.

Note that
a) Vaibhav scores more than Siddhant
b) Siddhant score better than Vaibhav in both individual topics - 5/6 > 20/25 and 20/28 > 6/9

How is it possible?