Pergunta de entrevista da empresa Viasat

How would you find the first non repeating character in a string?

Respostas da entrevista

Sigiloso

6 de mai. de 2012

My answer was to go through the string adding the characters to a hash and updating the value. Then going through the string again and checking the characters. The first key that has value 1 is the first non repeating character

2

Sigiloso

9 de mar. de 2017

x = "raviteja" y = {} for i in x: if i in y: print i, "repeated" break else: y[i]=1

1