DEV Community

Discussion on: A coding interview question asked at Google

Collapse
 
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']
Collapse
 
rascanoo profile image
rascanoo

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 :-(