Help me understand when to use Arraylist and when to use Arrays in Java 21

Правка en1, от devcode24, 2024-08-29 12:53:26

So here is the problem I am facing, for the problem --> 1827A - Counting Orders, I am getting AC when putting a solution using arrays, and getting a TLE when using ArrayList.

Here are the two solutions: using Array --> 278615778 using ArrayList --> 278615175

So tell me whether I should use ArrayList or Arrays for solving problems because this is not the only problem where I have faced this issue, there were others also.

Can anyone who has experience using Java tell me whether I should use ArrayList or Arrays?

Теги java, tle, array, arraylist

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский devcode24 2024-08-29 12:56:44 4 Tiny change: 'g AC when putting a solu' -> 'g AC when using a solu'
en2 Английский devcode24 2024-08-29 12:55:39 9 Tiny change: 'ubmission:278615175]\n\nSo te' -> 'ubmission: 278616942]\n\nSo te'
en1 Английский devcode24 2024-08-29 12:53:26 622 Initial revision (published)