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.
You are correct and the total complexity will be O(|s|.n^2). How ever this can be easily done in O(|s|.n + n^2) with the help of O(n^2) space. Which is a good trade off for a smaller n.
Two Characters
You are viewing a single comment's thread. Return to all comments →
You are correct and the total complexity will be O(|s|.n^2). How ever this can be easily done in O(|s|.n + n^2) with the help of O(n^2) space. Which is a good trade off for a smaller n.