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.
Both of these solutions (JS and C#) are O(n*m) where n and m are the lengths of the inputs. You need to change to a different approach to reach O(n+m).
Also (unrelated to the algorithm): you're created two new lists that you throw away immediately.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
Both of these solutions (JS and C#) are
O(n*m)
wheren
andm
are the lengths of the inputs. You need to change to a different approach to reachO(n+m)
.Also (unrelated to the algorithm): you're created two
new
lists that you throw away immediately.