Bank of America Interview Question

Remove duplicated char within a String

Interview Answers

Anonymous

Apr 5, 2014

boolean array, O(n)

2

Anonymous

May 20, 2016

s = 'ssammplee' sl = list(s) sl_dedup = [a for a, b in zip(sl[:-1], sl[1:]) if a!=b] + [sl[-1]] s_dedup = ''.join(sl_dedup)

Anonymous

Sep 4, 2019

function removeDuplicate string ){ var unique=''; for(var i=0; i