A few problems with your code : 1)Very Unclear (sorry !):- Either use a camelCase like java or use the c++ underscores style .Paste ur code on pastebin etc. 2)Too many loops :- It is O(n) , but perhaps O(4000*n) , much worse than O(n^2) in this case. 3)The problem is based on majority element concept :- No it's not ! It's a simple hashing problem . 4)Use scanf and printf , never ever use cin and cout , they are too slow .(Same holds for java , use printwriter , never scanner etc. )
5)AC code :-http://pastebin.com/FkBiS6S3 PS:Nice practice problem , it's been 2 months since I opened spoj (Increased my points by .6 :D):P -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@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.