We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
After reading @kiwi71728 comments, it explain great.
My approach is different, but I don't have any strong theory, but the logic is the same with what kiwi71728 explain.
What I do is first create matrix difference.
abacbaa010110b101101c111011a010110b101101a010110
From the matrix difference in there, I realized the the diagonal \ is the k we search. Then I add it to the list. From the matrix in there, the list become
Substring Diff
You are viewing a single comment's thread. Return to all comments →
After reading @kiwi71728 comments, it explain great. My approach is different, but I don't have any strong theory, but the logic is the same with what kiwi71728 explain.
What I do is first create matrix difference.
From the matrix difference in there, I realized the the diagonal \ is the k we search. Then I add it to the list. From the matrix in there, the list become
Then loop again from the list to slice for each item in the list, the find the longest length if the sum is the same or less with k.