6 kyu
World Bits War
520 of 1,378GiacomoSorbi
Description:
Variation of this nice kata, the war has expanded and become dirtier and meaner; both even and odd numbers will fight with their pointy 1
s.
And negative integers are coming into play as well, with, ça va sans dire, a negative contribution (think of them as spies or saboteurs).
A number's strength is determined by the number of set bits (1
s) in its binary representation. Negative integers work against their own side so their strength is negative.
For example -5
= -101
has strength -2
and +5
= +101
has strength +2
.
The side with the largest cumulated strength wins.
Again, three possible outcomes: odds win
, evens win
and tie
.
Examples:
[1,5,12] => "odds win" // 1 + 101 vs 1100, 3 vs 2
[7,-3,20] => "evens win" // 111 - 11 vs 10100, 3 - 2 vs 2
[7,-3,-2,6] => "tie" // 111 - 11 vs -1 + 110, 3 - 2 vs -1 + 2
Bits
Binary
Arrays
Fundamentals
Similar Kata:
Stats:
Created | Jan 23, 2017 |
Published | Jan 24, 2017 |
Warriors Trained | 2831 |
Total Skips | 425 |
Total Code Submissions | 4858 |
Total Times Completed | 1378 |
JavaScript Completions | 414 |
Python Completions | 520 |
Ruby Completions | 59 |
Crystal Completions | 10 |
PHP Completions | 81 |
Java Completions | 216 |
C# Completions | 113 |
C Completions | 54 |
Total Stars | 75 |
% of votes with a positive feedback rating | 96% of 340 |
Total "Very Satisfied" Votes | 313 |
Total "Somewhat Satisfied" Votes | 26 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 10 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |