You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ContainsDuplicate.java, the current solution has a time complexity of O(n^2), where n is the number of elements in the array. This can become very slow for larger arrays.
We can still do it solely using arrays, by first sorting the array. Then, iterating through the sorted array and checks if adjacent elements are equal. This can lead to a time complexity of O(n log n).
The text was updated successfully, but these errors were encountered:
In ContainsDuplicate.java, the current solution has a time complexity of O(n^2), where n is the number of elements in the array. This can become very slow for larger arrays.
We can still do it solely using arrays, by first sorting the array. Then, iterating through the sorted array and checks if adjacent elements are equal. This can lead to a time complexity of O(n log n).
The text was updated successfully, but these errors were encountered: