We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
this confused me for a bit too, but take a look at the syntax again. the syntax is saying, if res is true and res[len(res)-1]==c is true, then the equality is true.
more concretely, here is another example
if5and4==4:print("True")#This prints True
5 is always true as it is not compared to anything, thus the equality will always return true so long as 4==4
in this problem, res will always be true so long as it is not an empty list.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →
this confused me for a bit too, but take a look at the syntax again. the syntax is saying, if res is true and res[len(res)-1]==c is true, then the equality is true.
more concretely, here is another example
5 is always true as it is not compared to anything, thus the equality will always return true so long as 4==4
in this problem, res will always be true so long as it is not an empty list.