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.
defhackerrankInString(s):# Write your code herea=['h','a','c','k','e','r','r','a','n','k']end=len(s)-1whileend>=0:iflen(a)<1:breakcurrent=s[end]current_match=a.pop()ifcurrent!=current_match:a.append(current_match)end-=1return"NO"iflen(a)>0else"YES"
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
HackerRank in a String!
You are viewing a single comment's thread. Return to all comments →