[Python doubt] Counter vs Dictionary

Правка en1, от ashktchm, 2023-11-18 14:45:50

I read somewhere that using collections.Counter is faster for getting the count of the elements in an array. Is this true?

If yes, can someone tell me why did 233131667 TLE while 233285899 using inbuild python dictionary get Accepted? I tried using collections.defaultdict which also gave TLE.

Apologies if I am missing something.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский ashktchm 2023-11-18 14:45:50 407 Initial revision (published)