Ad
  • Custom User Avatar

    ahhhhh ok. thanks for the help!

  • Custom User Avatar

    z is always in the right side team, it's not about positions.

  • Custom User Avatar

    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?

  • Custom User Avatar

    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.

  • Custom User Avatar

    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).

  • Custom User Avatar

    ^ 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.

    X Y X ^ Y
    0 0 0
    0 1 1
    1 0 1
    1 1 0

    See: https://wiki.python.org/moin/BitwiseOperators