My out is almost correct but I am not able to pass the test case
Sum it up problem
@vivekpatel there should spaces between every no.
o/p for the input testcase is:
1 1 6
1 2 5
1 7
2 6
but your o/p is:
116
125
17
26
Also for input :
4
1 1 2 2
3
your output:
12
12
correct:
1 2
I am not unable to print spaces between them
tell me your approch to solve the problem
You can refer this-
I have removed duplicates at the time i achieved a answer and given space while printing
@vivekpatel
m.find(s)==m.end()
I am unable to under stand this
how and why are you using map
m.find(s)==m.end()
it means s is not present in the map.
i have used map as it it is the property of map
that it remove duplicates automatically
like if u insert in map following numbers
1 2 3 2 1 3 3
map will contain 1 2 3 only
how map can remove 1, 7 and 7 , 1
s is storing 17 for both of them so in map 17 and 17 gets inserted which makes one 17
string 17 and 71 are diffrent
if there is one permutation of 1 , 7 and of 7, 1 then map will treat them same
wait i am implementing it a little simpler will tell you in few mins
here see this i have sorted the initial array so s becomes 17 both times
i hope it now became cleared
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.