Pergunta de entrevista da empresa TrialPay

Find the missing element in a string

Resposta da entrevista

Sigiloso

13 de jul. de 2013

If elements are lower case alphabets, then we can solve it in O(n) using integer and bit manipulation. Assume that we only need to find first missing element in ascendant order. def find_missed(str) flag = 0 # n loops str.split('').each do |chr| flag = flag | (1 nil puts find_missed("abcdefghijklmnopqrtuvwxyz") #=> s However there is no information about elements, I'm not sure whether this approach is proper or not.