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.
This solution has a nested loop and takes quadratic time, so the test cases it fails are most likely timeout errors. Try to think of a linear time solution (hint: you don't need to find all the substrings. You just need to know how many substrings start with every character.)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Minion Game
You are viewing a single comment's thread. Return to all comments →
This solution has a nested loop and takes quadratic time, so the test cases it fails are most likely timeout errors. Try to think of a linear time solution (hint: you don't need to find all the substrings. You just need to know how many substrings start with every character.)