Google Interview Question
Software EngineersCountry: United States
def findExtraChar(s,t):
if s in t:
return t.replace(s,'')
if t in s:
return s.replace(t,'')
"""xor two strings together"""
res = 0
# end and xor with res
for i in range(len(s)) :
# xor with res
res =res ^ (ord)(s[i])
# end and xor with res
for i in range(len(t)) :
# xor with res
res = res ^ (ord)(t[i])
return ((chr)(res))
using binary search we can find
- pradeep January 19, 2020