脸熟 NG 实习店面

45 min Interview over the phone. 5 minutes of introduction. 35 minutes of coding. 7-8 mins of questions

Question 1: https://leetcode.com/problems/valid-palindrome-ii/
I was able to solve this within 10 minutes.

Question 2: https://leetcode.com/problems/custom-sort-string/
This one took me a while. I first gave a brute force solution(n^2) then I had time so he asked me to improve it. I gave (n+m) solution later. It took me 20-25 mins in total to come up with both of these solutions.

Given a string as a “source” string, find the smallest substring of source such that it contains all characters in “search” string (which contains distinct characters).

For example, for search string [‘a’,‘b’,‘c’], source string “aefbcgaxy”, the shortest string is “bcga”.