Open sanjarcode opened 2 years ago
This is important. Until now, I've been OK with what the interviewer was satisfied with and didn't actually prove/calculate optimality. This is bad because 'interviews' are not the goal of Data Structures or Algorithm Design for that matter.
My quick and dirty way to 'estimate' optimality. For coding questions, I calculate the time complexity of my solution and make sure it is less than 108 ops/second. But, as said, it's not about winning contests, I need to prove optimality.
Consider this problem to understand Trapping Water - LeetCode
By the way, this gave TLE error on LeetCode.