3 ms·
I've been doing this while optimizing leetcode problems recently. I just force myself to step through the same logic that the computer is doing to solve the pr
by ALittleLight 6y ago
I've been doing this while optimizing leetcode problems recently. I just force myself to step through the same logic that the computer is doing to solve the problem. Not the code, but the same logical manipulations to calculate the answer the same way the code is.
Very often I'll find myself thinking "This is a waste of time, I could easily shortcut this by... X" and when I find the shortcuts that make the "by hand" process more manageable, I can apply that same logic to the code and make it faster as well.