0
[Solved] Java
Please tell me how can I shorten this code? https://code.sololearn.com/cao6p8AhR4Rg/?ref=app
5 Answers
0
It is better start from the scratch, than to refactor your code.
Read please the Google Java code style,
Don't use ArrayList, and learn how to define them properly
Get rid of first for loop, at least.
Using for loop is bad practice on production, learn streams instead đ
+ 1
The goal sometimes is not to find the fastest solution but the most stable and clear one. Btw, the solution above has O(n^2), not fast at all.
+ 1
It the first thing you will be asked on interview, when you get you test project done. And the second would be, how can you improve that?
0
streams are slow
0
Adel Ibragimov Thanks for your answer..
But I don't know anything about Time complexity.. đ