Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
ahhhhh ok. thanks for the help!
z is always in the right side team, it's not about positions.
This makes sense but in one of the examples -> alphabetWar("zzzzs"); there are 5 'combatants' so is the middle z on the right or left side?
I would define efficiency as having your code only do what is necessary to solve the problem, and no more. In this problem, for instance, it would be efficient for the search for a different number to end as soon as the different number is found.
The string can contain the letters
w, p, b, s, m, q, d, z
, as well as other letters that don't affect the score.w, p, b, s
are on the Left Side team. Add their score together to get Left Side's total.m, q, d, z
are on the Right Side team. Add their score together to get Right Side's total.Other letters are on no team, don't have a score, and don't contribute to either team's total.
Compare the two totals and figure out who wins (or if they tie).
^ is bitwise exclusive or
It compares corresponding bits in two numbers. It sets the corresponding bit in the output to 0 if the two corresponding input bits are the same and 1 if the bits are different.
See: https://wiki.python.org/moin/BitwiseOperators