0

[Solved] Java

Please tell me how can I shorten this code? https://code.sololearn.com/cao6p8AhR4Rg/?ref=app

13th Jul 2020, 1:45 PM
SHIVANSH
SHIVANSH - avatar
5 Antworten
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 😉
13th Jul 2020, 8:16 PM
Adel Ibragimov
Adel Ibragimov - avatar
+ 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.
15th Jul 2020, 5:45 AM
Adel Ibragimov
Adel Ibragimov - avatar
+ 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?
15th Jul 2020, 11:54 AM
Adel Ibragimov
Adel Ibragimov - avatar
0
streams are slow
14th Jul 2020, 12:28 PM
zemiak
0
Adel Ibragimov Thanks for your answer.. But I don't know anything about Time complexity.. 😑
15th Jul 2020, 6:14 AM
SHIVANSH
SHIVANSH - avatar