Amazon Interview Report
- 0of 0 votes
AnswersWrite function compress(char* strSource)
- Interviews January 29, 2012 in India
it should do the following .
repeating chars in sequence should be replaced with char & count, in case count is 1 no need to add any integer.
Example - AAAABBBCXYZEEEEPPPPPKKABC
should be A4B3CXYZE4P5K2ABC.
you are supposed to iterate the array only once, and modify the same input parameter, do not create any new string.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer String Manipulation - 0of 0 votes
Answerswrite a function strRemove(char *source, char *remove )
- Interviews January 29, 2012 in India
This function will delete all the chars that exist in string remove from array source, number of iteration should be only 1. Make the searching efficient.
Example
("amazon development center", "aenr")
"mzo dvlpmt ct".
Criteria - First parameter should be modified , no need to create an extra string.
(Answer - Put the second array in a hash table, like array of 256 chars, to search which are the chars needed to be removed with complexity o(1) )| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer String Manipulation