Draft

Yuddh - At War!!

Description:

There will be no peace talk, no negotiations, there will only be Yuddh(War).

General, here you have troop composition of two armies given to you as 2 lists. These armies consist of equal number of regiments.

Each element in the list represent a regiment, the numerical value of each element is the number of soldiers in the respective regiment. Note, the length of the two armies will always be equal.

Now comes the interesting stuff,

The power of 1 soldier in a regiment = 2^(Position of regiment in the army list)

Then power of entire regiment = Number of soldiers in regiment X Power of 1 Soldier

For example: [2000, 400]

Here, Power of 1 soldier of Regiment 1 = 2^1 = 2,

Then the Power of entire Regiment 1 = 2000 X 2 = 4000

Similarly, Power of 1 soldier of Regiment 2 = 2^2 = 4,

Then the Power of entire Regiment 2 = 400 X 4 = 1600

So, the power of entire army = 4000 + 1600 = 5600

Now, your task is to find which army will win the battle based on crude power and the winner's remaining crud power.

Example: Army_1 = [2000, 400]; Army_2 = [1400,600]

Power of Army_1 = (2000 X 2) + (400 X 4) = 5600

Power of Army_2 = (1400 X 2) + (600 X 4) = 5200

Battle: Army_1 > Army_2; Army_1 Won; 400 soldiers left

Output: "Army_1:400"

In case of a tie i.e. Power of Army_1 = Power of Army_2,

Output: "Tie"

-----------------------------------------------------------x-----------------------------------------------------------

This is my first Kata, hope you enjoyed coding it :) Kindly provide me your suggestions in the comments. Bye.

Mathematics

Similar Kata:

Stats:

CreatedJun 14, 2022
Warriors Trained40
Total Skips2
Total Code Submissions91
Total Times Completed33
Python Completions33
Total Stars1
% of votes with a positive feedback rating80% of 22
Total "Very Satisfied" Votes15
Total "Somewhat Satisfied" Votes5
Total "Not Satisfied" Votes2
Total Rank Assessments22
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Rudr Avatar
  • hobovsky Avatar
Ad