+ 3
What approach can i use to find first repeating element in an array?
Without sorting, and without hashmap.
6 Antworten
+ 5
Just iterate over the array and add each value to a Set.
The add method of Set returns false if the entry already exists.
+ 3
Lol yeah bro .
+ 1
Codder kitten i must be doing it easily by sorting array but it is said that without sorting i have to do this problem.
+ 1
Codder kitten is their any other approach rather than hashmap
+ 1
The boundation is we should maintain O(n) time complexity without sorting and hashmap
so an effective algo needed.
+ 1
Piyush Srivastava you should have described all aspects of your problem in the first post to get the right answer in less time 😀.