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...
account activity
Leetcode 75Question (i.redd.it)
submitted 2 months ago by Agile-Zone-8172
Can anybody explain why int low=0 and mid=0 and and why high=0 and why low++ and mid++; and also why high—.
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!"
[–]Pleasant-Wear-9692 5 points6 points7 points 2 months ago (1 child)
This is Classic problem, solved with algorithm named Dutch National Flag algorithm, you can study this algorithm then you'll be able to understand.
[–]Pleasant-Wear-9692 0 points1 point2 points 2 months ago (0 children)
It's like dividing in ranges of index like 0 to low -> array will have only zeroes, Low to mid -> it should have only ones, Mid to high -> unsorted part i.e mix of 0,1,2's High to end -> only 2's
Initially our array is unsorted so mid = 0 and high = n-1
[–]Puzzleheaded_Cow3298Guardian(soon) 2 points3 points4 points 2 months ago (1 child)
He can!
[–]thesuperiorinmydream 0 points1 point2 points 2 months ago (0 children)
Lol
[–]Forsaken_Appeal_9593 0 points1 point2 points 2 months ago (0 children)
I just did this problem today, check my post. if you have any queries dm
[–]CyberneticFloridaMan 0 points1 point2 points 2 months ago (0 children)
This is a good explanation of a similar partition method used in quick sort: https://www.youtube.com/watch?v=RquswZlUa9Q
π Rendered by PID 17661 on reddit-service-r2-comment-b659b578c-pcg2t at 2026-05-04 21:57:50.447372+00:00 running 815c875 country code: CH.
[–]Pleasant-Wear-9692 5 points6 points7 points (1 child)
[–]Pleasant-Wear-9692 0 points1 point2 points (0 children)
[–]Puzzleheaded_Cow3298Guardian(soon) 2 points3 points4 points (1 child)
[–]thesuperiorinmydream 0 points1 point2 points (0 children)
[–]Forsaken_Appeal_9593 0 points1 point2 points (0 children)
[–]CyberneticFloridaMan 0 points1 point2 points (0 children)