![]() Q.3: What is the time complexity of finding the longest non-repeated substring?Īns: The time complexity of finding the longest non-repeated substring is O(n). Q.2: What is the time complexity of the longest common substring?Īns: It depends if we donât use dynamic programming to store subproblems then it would be O(3^(n+m)) time and O(1) space and using dynamic programming its O(n m) time and O(nm) space where n,m are lengths of sequence. Time complexity: O(n*m), Where n and m are the lengths of sequences.įrequently Asked Questions Q.1: How do you find the longest common substring?Īns: The most efficient method is to use the dynamic programming approach of storing sub-problems. String 'abcfedbca' subString 'fed' Actually i asked him to elaborate a little more to which he said 'it's easy java implementation what should i elaborate' and on basis of this question only he said my core java is very weak. I was given 5 minutes to write the complete code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |