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.
Here is a O(n+m) time and O(1) space solution in python.
O(n+m) is the average of the worse case scenarion, where all 26 chars will be present in every string. This means in the worse case the time will be O(Ch*n).
Gemstones
You are viewing a single comment's thread. Return to all comments →
Here is a O(n+m) time and O(1) space solution in python.
O(n+m) is the average of the worse case scenarion, where all 26 chars will be present in every string. This means in the worse case the time will be O(Ch*n).