Hi Gaurav, yup solution is quite right but that is the worst case....but if wanna that solution in O(n) time complexity and O(1) space complexity but in ur solution it is O(k) space complexity.
On Wed, Jul 7, 2010 at 7:17 AM, Gaurav Singh <gogi.no...@gmail.com> wrote: > I think you can use counting array in this algo. And keep checking > whenever the count of any element goes ahead of 1, it will be the > first repeating element. > Is it something more difficult than this ?? Please correct me if > anything is wrong in my thought. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Thanks & Regards Umesh kewat -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.