DEV Community

Discussion on: A coding interview question asked at Google

hyftar profile image
Simon Landry

I'm not convinced this works with every case; You're missing some edge cases such as

['a,a,a,-B,-B,c', 'a,c']
rascanoo profile image

Hi Simon,

You are correct, well spotted. I changed the solution to reflect your case and hopefully all cases :-)
Couldn't do it with one regex though :-(