You are viewing a single comment's thread. Return to all comments →
Complexity analysis does not care about the constant factors. It cares only about how time and space grows as you increase variables like n and d.
Arguably, all of the variables are bounded by constants in the problem statement, so all solutions are O(1) time and O(1) space.
If variables are unbounded, with large d, your solution would need more auxiliary space for your queue, whereas mine would not.
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Triplets
You are viewing a single comment's thread. Return to all comments →
Complexity analysis does not care about the constant factors. It cares only about how time and space grows as you increase variables like n and d.
Arguably, all of the variables are bounded by constants in the problem statement, so all solutions are O(1) time and O(1) space.
If variables are unbounded, with large d, your solution would need more auxiliary space for your queue, whereas mine would not.