+ 1

Linked list java

how to "combine" same value in array, sum the same value by 1 then remove the second same value until no same value appear. ex : arr{1,1,4,5} result = {2,4,5} // 1+1 , then remove second value arr{1,1,2} result ={3}//1+1={2,2} -> same value 2+1= {3} remove the second value again. what should method linked list array i use?

22nd Jun 2017, 7:30 AM
Sonny Michael
Sonny Michael - avatar
4 ответов
+ 2
https://code.sololearn.com/cFC6oCRPZgVC try this... still not perfect though just giving you an idea :D
22nd Jun 2017, 8:36 AM
AJ Carlos
AJ Carlos - avatar
0
There is currently no method that combine two values from an array. But you can create an algorithm for it.
22nd Jun 2017, 7:49 AM
AJ Carlos
AJ Carlos - avatar
0
so any clue to solve it?
22nd Jun 2017, 7:55 AM
Sonny Michael
Sonny Michael - avatar
0
thx a lot
22nd Jun 2017, 9:08 AM
Sonny Michael
Sonny Michael - avatar