- 1
New Licence
Soo I Have been Working on this, I don't know how to optimize it to pass the code coach What is the problem? Lesson: https://www.sololearn.com/coach/18 https://code.sololearn.com/cRE3Q6QcpOUv/?ref=app
2 ответов
+ 1
your array is too short
try input: "eee\n 2\n bbb aaa ccc ddd" you get:
[aaa, bbb, ccc, ddd, eee] list
[[aaa, bbb], [ccc, ddd]] arr
40
eee is not in arr, because for() stops at the end of arr, at name ddd,, not eee
and return wrong answer
then your code produce warning because you use unchecked raw ArrayList
for better result, use extra <> in declaration:
//ArrayList<String> list = new ArrayList();
ArrayList<String> list = new ArrayList<>();
0
Thank You So Much For Feed Back
I Will Try To Fix