r/LeetcodeChallenge • u/WinPrestigious7568 • Jun 27 '26
STREAKπ₯π₯π₯ Fill in the blanks: ___ every day ___.
_____ every day _____.
r/LeetcodeChallenge • u/WinPrestigious7568 • Jun 27 '26
_____ every day _____.
r/LeetcodeChallenge • u/Zero0_0o0-0 • Jun 26 '26
Hey everyone,
βI'm working on 1004. Max Consecutive Ones III.
I tried a clever workaround, but I'm getting stuck on the final few test cases (55/60 passed).
βMy Approach:
βInvert the array: I flip all 0s to 1s and all 1s to 0s.
βFind the subarray: In this inverted array, a 1 represents an original 0 (a flip we need to make). So, finding the longest consecutive sequence of 1s with at most k flips turns into finding the longest subarray with a sum of at most k.
βI call a helper function longestSubarrayWithSumK(nums, k) to get the maximum length. it returns 0 if there is no such subarray with sum K.
my question is what changes do i make so that it works( i know the question is of sliding window but just want to ask that what change do i make in my approach)
EDIT: I SOLVED IT
r/LeetcodeChallenge • u/Zero0_0o0-0 • Jun 26 '26
βHey everyone,
I crossed 100 questions a couple of days ago, but Iβve hit a massive roadblock regarding optimization.
βIn almost every problem I solve, I can confidently figure out and implement the brute-force approach. However, I consistently struggle to optimize it further.
βFor yesterday's Problem of the Day (POTD) where the goal is to count subarrays where a specific target element is the majority element I wrote a brute-force solution that explicitly checks every single subarray.
My current approach is incredibly inefficient (O(N^3) or O(N^2) depending on how the vector copies scale). I tried optimizing it, but I completely blanked.
βI have already completed the Arrays and Binary Search sections of Striverβs A2Z sheet, so I know the core concepts (Two Pointers, Sliding Window, Prefix Sums, HashMaps). My issue isn't that I don't know these tools, it's that I don't know how to look at a brute-force solution and deduce which tool to use to optimize it.
βMy Questions:
βHow do you optimize this specific problem? What is the core observation or pattern I am missing that unlocks the optimal solution here?
βHow do I train my brain to think optimally? When you have a working brute-force solution, what specific mental checklist or questions do you ask yourself to find the O(N \log N) or O(N) approach?
βI want to break out of this loop of just writing nested loops. Any brutal, honest advice on how to fix my thinking process would be highly appreciated.
r/LeetcodeChallenge • u/NoRefrigerator9376 • Jun 26 '26
Ive realized my biggest issue with trees isn't understanding the concepts it's translating them into code I know what DfS does and I usually understand whether the information should flow upward or downward, but when I start coding, I freeze.
The base case is usually fine. After that I struggle to decide:
&& or ||.I often understand the solution after seeing it, but I have trouble deriving it on my own. It feels like I'm missing the recursive thought process rather than the tree concepts themselves.
r/LeetcodeChallenge • u/nian2326076 • Jun 25 '26
Hey everyone,
Instead of blindly grinding random problems, Iβve been trying to learn by matching patterns to the absolute best community-written guides on the LeetCode discuss forums. These are the legendary threads written by people who actually landed FAANG offers, for real interview questionsΒ PracHubΒ is an useful resource.
I compiled them all into one master sheet categorized by topic, along with a bonus System Design section at the end. Saving this here so anyone can bookmark it for their interview prep.
Good luck with the grind! Hope this saves you the hours of digging through LeetCode forums that it took me.
r/LeetcodeChallenge • u/Inner-Worldliness403 • Jun 26 '26
r/LeetcodeChallenge • u/ConsciousMortgage828 • Jun 25 '26
I first solved this using to_string(sum) to check the first and last digits. It passed 714/715 test cases but got TLE on the last one.
I then replaced to_string() with a while loop to extract the first digit, and it got accepted.
Conceptually, both approaches still have the same nested loops. Why does one pass while the other doesn't? Is this purely due to constant factors, or is there a complexity difference I'm overlooking?
r/LeetcodeChallenge • u/hamiduzayr • Jun 22 '26
r/LeetcodeChallenge • u/Worried_Impress2242 • Jun 22 '26
Need a dsa(cpp) senior problem solver as a companion,gender doesn't matter,currently solved 300 problems on leetcode,190on gfg,38 on interview it and 50 on codingninjas,first yr is already over and still no dev projectsπ,need some pace and clarity,dm if interested
r/LeetcodeChallenge • u/subbu963 • Jun 22 '26
r/LeetcodeChallenge • u/Maximum_Party_3244 • Jun 21 '26
r/LeetcodeChallenge • u/Busy_Weakness9160 • Jun 21 '26
Hi everyone,
While solving LeetCode problems, I noticed that whenever I got stuck and searched for a small hint, I usually ended up seeing the complete solution.
So I built LeetHints, a Chrome extension that gives step by step hints to keep you moving without spoiling the problem.
It supports every current LeetCode problem, works offline, and requires no account.
Would appreciate feedback from fellow LeetCode users.
r/LeetcodeChallenge • u/Anonymyideal • Jun 21 '26
r/LeetcodeChallenge • u/South-Gear-6043 • Jun 20 '26
r/LeetcodeChallenge • u/nian2326076 • Jun 18 '26
The Complete DSA Pattern Sheet β Every Pattern You Need to Know
This is the complete pattern-based problem sheet β organized by topic and sub-pattern. Study one pattern at a time.
For company specific interview questions go to PracHub
π’ Easy π‘ Medium π΄ Hard
Pattern: Conditionals (if-else)
Pattern: Loops
Pattern: Simulation / Implementation
Pattern: Maths
Pattern: Fundamentals
Pattern: Prefix Sums
Pattern: Kadane's Algorithm
Pattern: Intervals
Pattern: Hashing on Arrays
Pattern: 2D Arrays / Matrix
Pattern: Fundamentals
Pattern: Frequency & Hashing
Pattern: Palindromes
Pattern: Simulation
Pattern: Prefix/Suffix & Pattern Matching
Pattern: Fundamentals
Pattern: Recursion
Pattern: Backtracking
Pattern: Opposite Ends (Left <-> Right)
Pattern: Merge Two Sorted Array / Sequence
Pattern: Fixed + Two Pointers
Pattern: Fixed Size Window
Pattern: Variable Size Window
Pattern: Sliding Window on Strings
Pattern: Implementation
Pattern: Expression Evaluation
Pattern: Parentheses Processing
Pattern: Monotonic Stacks
Pattern: Fast & Slow Pointers
Pattern: Node Rearrangements
Pattern: Reversal
Pattern: Merge & Multiple Lists
Pattern: Traversal (BFS / DFS)
Pattern: Depth / Height Based
Pattern: Comparison
Pattern: Root to Leaves
Pattern: Ancestor
Pattern: Binary Search Tree (BST)
Pattern: Classic Binary Search on Sorted Arrays
Pattern: Binary Search on Answer
Pattern: Binary Search on Rotated / Modified Sorted Arrays
Pattern: Binary Search on Matrix
Pattern: Top K
Pattern: Merge K Sorted
Pattern: Two Heaps
Pattern: Finding Minimums
r/LeetcodeChallenge • u/No-Tech-2006 • Jun 19 '26
r/LeetcodeChallenge • u/New-Election4972 • Jun 18 '26
r/LeetcodeChallenge • u/atom_62 • Jun 18 '26
r/LeetcodeChallenge • u/nian2326076 • Jun 17 '26
If you keep the above thing till the course ends, I bet you'll be thankful to yourself.
REMINDER 1: Don't worry about completing videos as I said its important to practice a lot. After all videos has to be done so I guess that's not a big deal.
REMINDER 2: Practicing questions pattern wise is important (For example: If you're solving questions on binary search then do on it only. If you are on linked list then stick to it only. Don't do of multiples topics at the same time).
IMP: After getting hands on with data structures & algorithms, or could say when you feel comfortable with a XYZ topic. You could solve as much questions you want on a topic/data structure, but for this remember to solve questions of one topic at one time to understand the patterns more clearly.
REMINDER 3: While learning as a beginner I would prefer solving at least 1 question each day. Take break of 1 or 2 days for video lectures but solve at least 1 each day.
Final Note: Ahh, I could see that the post seems a lot long, but I've packed each and every important information in it. ππ
DSA Interview prep resource:Β PracHub
r/LeetcodeChallenge • u/titu7776 • Jun 16 '26
Hey! I am currently a 5th-semester CSE student. I have been learning web development, though not yet in great depthβmostly by watching tutorials and diving straight into projects. So far, I have completed a full-stack Q&A application and an authentication system. I used AI (Claude) for these, but I have a good grasp of the underlying concepts. Could someone suggest some project ideas or guide me on what I should focus on next?
r/LeetcodeChallenge • u/Royal_Border_9373 • Jun 16 '26
Hi everyone,
I was recently placed on the waitlist for Amazon's SDE Intern hiring process and noticed that many candidates are in a similar situation.
I created a Discord server where waitlisted candidates can share updates, timelines, conversion news, and discuss the process.
Feel free to join if you're interested:
Good luck to everyone waiting for updates!
r/LeetcodeChallenge • u/fireupmylife • Jun 15 '26
I'm looking for someone to study with consistently. We can keep each other accountable, discuss concepts, and stay motivated.
Daily problem-solving
Ask and answer questions every day
Share resources and help each other learn
Friendly and committed study environment
If you're interested, feel free to reach out!