Same solution produces drastically different time and space performance

I have observed it several times that submitting the exact same solution more than once produces different space and time complexity. Most of the times, it's generally small different so I ignore it but today I noted a drastic difference.

I submitted DFS approach of Course Schedule problem 3 times only to get time complexity ranging from 7 sec to 23 sec!! Is anyone aware of such a thing?

image

Comments (0)