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.
Yes. An ArrayList has O(n) time to find an element if it's not sorted. You can find an element in O(log n) time if it's sorted (using binary search). A HashSet can find an element in O(1) time. I used a HashSet too.
Weighted Uniform Strings
You are viewing a single comment's thread. Return to all comments →
Yes. An ArrayList has O(n) time to find an element if it's not sorted. You can find an element in O(log n) time if it's sorted (using binary search). A HashSet can find an element in O(1) time. I used a HashSet too.
HackerRank solutions.