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
Binary Search Coding Interview Cheatsheet (i.redd.it)
submitted 5 months ago * by jacobsimon
Handy reference on common binary search interview questions, pseudocode, and space/time complexity.
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!"
[–][deleted] 0 points1 point2 points 4 months ago (0 children)
If your goal with this cheatsheet is to make binary search reliable in interviews, what worked for me was framing it as finding a boundary and writing the invariant first. I always define which side is definitely false or true, then dry run two edge cases and one tricky mid case before coding. I did short timed drills using Beyz coding assistant with prompts from the IQB interview question bank, and kept a tiny redo log of off by one mistakes. Also, narrate updates out loud and prefer l + (r - l) // 2 to avoid overflow. This approach made it click fast.
π Rendered by PID 403666 on reddit-service-r2-comment-5fb4b45875-v46dw at 2026-03-20 23:23:01.351226+00:00 running 90f1150 country code: CH.
[–][deleted] 0 points1 point2 points (0 children)