mercredi 16 septembre 2020

how much time it takes for an 'if' statement in java

While solving a linked list question I got a TLE

then I found a useless 'if' condition in the code

if(fast==null||fast.next==null)return fast;

I removed it And guess what.. it passed I was surprised, can anyone please explain me how much time it take for a 'if' statement. And yes it was a recursive solution.

Aucun commentaire:

Enregistrer un commentaire