cruise automation phone screen

First Round

Two questions

  1. easy: given a string remove allcharacter which occure more than.

Eg if given string is"acbbeccbdeef" return “adf”

  1. Given an encoded string, return itsdecoded string. (exact leetcode 394)

s = “3[a]2[bc]”, return"aaabcbc".

s = “3[a2[c]]”, return"accaccacc".

s = “2[abc]3[cd]ef”, return"abcabccdcdcdef".

Second Round

One question

Given a mapping of phone

2 -> "abc"

3 -> "def"

4 -> "ghi"

..

9 -> "wxyz"

  

* -> sequence break (example below)

If you have to make “b” you haveto press 2 two times, if you have to make “z” you have to press 9four times.

Given a input sequence find out italphabetic representation e.g.


222449333 -> chwf

222*22*223*3334 ->cbbdfg

Interviewer was not paying attention, iexplained him entire logic and he said yes. I then coded everything and everystep he was saying looks good. and at the end he said, this logic is notcorrect. We didn’t have time but it’s ok it was not my day. Better luck next time