thnx it worked… i know all the simple basics of c++(class 11 nd 12) …i wanted to challenge myself so did the code using just that knowledge…so before doing ques on c++ what all topics should do? could u provide me with a list of some kind?
Bcz Test cases were weak , see what u did is taking an element and check whether it is present previously that means for each i u iterate a loop till i
so if u are at index n , u again iterate from 0 to n-1 , so overall complexity is O(N2) and here N is 106 => N2 = 1012 which is not possible to run in given Time Limit.
So better to take two set one for neg , one for pos and give the sum.
ohk…i couldnt understand some of the terms u used but got the gist of what u wanted to say…
so u are saying that first i should check that the particular term entered is positive or negative then check if that term has been entered before (sep for both cases) which will somehow decrease time taken?? (sry for using such crude terms…i wiill read about complexity nd time limits surely)…
sure … u have been of gr8 help …despite being a 4 star u have helped nd answered my doubts nd trivial ques…thnx for the time and effort…have a nice day