employer cover photo
employer logo
employer logo

Huawei Technologies

Is this your company?

Huawei Technologies Interview Question

Given a string a encoding key "FGAVOV", it can only be upper or lower case letters. If there are duplicates, only keep the first one. Use this key to encode another string such that A becomes F, B becomes G, C becomes A and so on. For the letter that not included in key, assume they are pended behind the last V in ascii. You should encode and decode in O(n) time.

Interview Answer

Anonymous

Nov 25, 2019

This very easy to do using dict in python.