Sunday, November 23, 2014

String Problems asked in Programming Interviews

Problem 1:
Find the longest anagram substring of a given string S2 in another string S1.
S1: ascfg
S2: acs
Output: asc



Problem 2:
Find all the anagram substrings of a given string S2 in another string S1.
S1: ascfgsa
S2: cas
Output: {asc, sa}

No comments:

Post a Comment