Good explanation, really simple solutions as well and supper easy to understand. Once you said Stack I pretty much came up with the same solution. :) thank you Nikhil !
def short(s): #s=aaabccddd a=list(s) b=set(s) for i in b: c=s.count(i) if c%2==1: for j in range(c-1): a.remove(i) else: for j in range(c): a.remove(i) d=''.join(a) if len(d)==0: return "empty string" else: return d s="aabbb" print(short(s)) I wrote this but 6 test cases failed
I can’t provide the solution in JS but you can check the complete code in the video description…if you understand the logic correctly..writing in JS shouldn’t be a problem.
What code did you come up with? I can help you understand your error. If I give you the solution right away, you wouldn’t learn. That is just the teacher in me speaking 🙂