DEV Community

Discussion on: Check if the chain has the same amount

 
ganeshtata profile image
Tata Ganesh • Edited

Do you mean lowering the string before the loop or lowering the character in the loop before checking whether it is an 'x' or 'o'?

  • Lowering the string before the loop would involve one complete pass of the string. And then you would have to iterate through the string, again, to count the frequencies.
  • Lowering just the character inside the loop, is just equivalent to the if condition, right? I am probably saving on a function call by not calling .lower() on the character.
Thread Thread
 
pbouillon profile image
Pierre Bouillon

Oh right, nevermind !