100 people standing in a circle in order 1 to 100. No. 1 has a sword. He kills the next person (i.e., No. 2) and gives the sword to the next (i.e., No. 3). All people do the same until only 1 survives. Which number survives at the last?
Round 4: Since they are in a circle, 97 killed 1, and in the last move, 89 killed 97, leaving us with these survivors. Round 4: 9, 25, 41, 57, 73, 89
Round 5: Now, 9 eliminates 25, 41 eliminates 57, and 73 eliminates 89, leaving us with these survivors. Round 5: 9, 41, 73
Round 6: Now, 9 eliminates 41, leaving 9 and 73. The next turn will be 73βs. Round 6: 9, 73
Round 7: Now 73 eliminated 9 , And 73 is the Last Survivor. Round 7: 73
Answer: 73
Method 3: Here, we can define an array with 100 elements with values from 1 to 100.
Start with people numbered 1 to N in a circle; each person kills the next and passes the sword forward.
This eliminates every alternate person, leaving only odd-positioned people after each round.
The process repeats until only one person (the survivor) remains.
Step 1 : For a given value of N, find the "Power of 2" immediately smaller than N. Letβs call it P Step 2 : Subtract N from (P-1). Lets call it M, i.e, M = (P-1)- N Step 3 : Multiply M by 2. i.e M*2 Step 4 : Subtract M*2 from P-1. Let's call it ans, i.e, ans = (P-1) - (M*2) So, the person with number "ans" will survive till last.