Intel Corporation Interview Question

Can you make a function that accepts a string and returns every other instance of each letter?

Interview Answer

Anonymous

Apr 10, 2018

Read a letter from the input. Use a dictionary to count the number of times the letter has already been seen. Increment the count and either add or omit the letter from the return string based on whether the count is even or odd.

1