Videos
Optimized way to find all substrings/subsets/subarrays
Not sure how to improve this answer. (Count the appearance of substring in string)
How did you guys get good at substring and 2 pointer problems?
Can this be done this way ? Find the Index of the First Occurrence in a String
Hi! This is entirely based on a pattern in LeetCode problems, but if I need to find ALL substrings/subsets/subarrays of a string/array, is there a way I can do it in less than O(n^2) time complexity? Thank you!
I can't find the question on leetcode but geeksforgeeks has it.
https://www.geeksforgeeks.org/videos/frequency-of-a-substring-in-a-string/
I just had an interview with a hiring manager. They gave me this question, I explained the same solution found in this link. They asked me about time complexity, I said O(n * m).
They asked me how I could improve the solution, internally I was floored and confused. I thought it couldn't be improve but I decided to give another answer anyways. This second answer was more complicated and they didn't ask about time complexity (I don't think it was improved) since we were running low on time. I went ahead and implemented yet although I had some bugs I was able to communicate but not able to fix before the end of the interview.
Is there really a way to improve this answer?