JAVA Discussion: Collections.sort() over Arrays.sort()

Revision en3, by ScoobyDoobyDo, 2021-03-25 20:50:58

Hey Friends,

I had a fundamental query to ask which is somewhat related to the submission (I stated below), Does using set.contains() { mainly takes log(n) time } functionality take longer than 2 seconds to compute for the data as large as 2*10^5 (if we check for every input of the array that is) I am asking this because my submission to the problem 1490E - Accidental Victory (E. Accidental Victory), gave me TLE on the specified constrained. My submission -: 110974416 (look for solve() function part please)

or, Is there any other thing that I'm missing out here. Any Help regarding this will be appreciated. Thanks in advance

UPD: Solution: It was improper sorting which caused the TLE not HashSet Related functionality.

Tags #java, #set, #tle, probleme

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English ScoobyDoobyDo 2021-03-25 20:50:58 186
en2 English ScoobyDoobyDo 2021-03-25 16:03:30 19 Tiny change: '.\nThanks \nFellow java Coder' -> '.\nThanks in advance'
en1 English ScoobyDoobyDo 2021-03-25 15:51:52 728 Initial revision (published)