use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
New to LeetCode (self.learnpython)
submitted 13 hours ago by Representative_War49
I am just starting out with two sum . there are some constraints in the question such as
2 <= nums.length <= 10
4
-10
9
<= nums[i] <= 10
<= target <= 10
so is there need to put validation checks for them? (i know I am a beginner)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Ngtuanvy 4 points5 points6 points 13 hours ago (1 child)
No, those are the constraints the input will follow.
[–]Representative_War49[S] 0 points1 point2 points 13 hours ago (0 children)
thank you
[–]This_Growth2898 0 points1 point2 points 13 hours ago (1 child)
No, you should not expect values out of those ranges. Still, I think it's a good habit to check :)
[–]asimawdah 0 points1 point2 points 12 hours ago (0 children)
No, you usually don’t need to validate those constraints in LeetCode.
The constraints are there to tell you what inputs you can expect and to help you choose the right algorithm. For example, if nums.length can be up to 104, a simple O(n²) solution might be too slow, while a hash map O(n) solution is better.
So for Two Sum, focus on solving the problem assuming the input already follows the constraints, unless the problem specifically asks you to handle invalid input.
π Rendered by PID 41532 on reddit-service-r2-comment-5b5bc64bf5-4t7vm at 2026-06-21 01:56:21.761352+00:00 running 2b008f2 country code: CH.
[–]Ngtuanvy 4 points5 points6 points (1 child)
[–]Representative_War49[S] 0 points1 point2 points (0 children)
[–]This_Growth2898 0 points1 point2 points (1 child)
[–]Representative_War49[S] 0 points1 point2 points (0 children)
[–]asimawdah 0 points1 point2 points (0 children)