[Python doubt] Counter vs Dictionary

Revision en1, by 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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ashktchm 2023-11-18 14:45:50 407 Initial revision (published)