- Published on
Google | Technical Phone Screening Round
- Author
- Shared Anonymously
Given a array of bytes (c++ string or char array or unit_8 array).
Please find a shortest byte sequence that does not present in the input array.
assume that "byte" contains only "a" to "f"
input: "abcdefacbeddefd"
"a" is present
"b" is present
..
"f" is present
"aa" is not present
"ab" is present
"ac" is present
you can return "aa" or "ad" or "ae"... "ff"
but not "ab" "ac" "bc"
input contains arbitrary bytes ('\x00' to '\xff'), not only letters
small testcase: input length <= 16MB
large testcase: input length <= 4GB
you have 8GB ram
length of the answer will always <= 4
Approach???
Report • Mark as Helpful