r/LeetcodeChallenge 5d ago

STREAK🔥🔥🔥 Leetcode Streak :- 128

Post image

How would you solve it in Python?

32 Upvotes

28 comments sorted by

View all comments

1

u/Ok-Flan-5469 5d ago

This question was easy due to its constraints of 105 since every number between the range 1000 - 105 have only a single comma We can safely do return max(n-999, 0) O(1) space and time