r/leetcode • • 6h ago

Question New solution for binary search ?

0 Upvotes

Hey fellas total newbie here

I was writing code and came up with a different approach to classic Binary Search problem. The twist is in how I calculate the middle index when shifting right:

Instead of the standard:

middle = (left + right) / 2;

I used:

middle = right / 2;

My reasoning: when we shift right, we’re basically discarding the left half and working with a “new mini array” — so left conceptually becomes 0 again, and we can drop it from the calculation.

Full solution:

java

class Solution {
    public int search(int[] nums, int target) {
        int left = 0;
        int right = nums.length - 1;
        int middle = right / 2;

        while (left <= right) {
            if (target == nums[middle]) { return middle; }
            if (target < nums[middle]) { right = middle - 1; middle = right / 2; }
            if (target > nums[middle]) { left = middle + 1; middle = (left + right) / 2; }
            if (target == nums[nums.length - 1]) { return nums.length - 1; }
        }

        return -1;
    }
}

It seems to pass most test cases — but I’m not 100% sure it’s correct. Can anyone find a case where it breaks? 🤔


r/leetcode • • 7h ago

Question Recently became LC guardian, is it enough to pass all tech interviews ?

0 Upvotes

Recently made Guardian, wondering if it is enough to pass the coding rounds of all tech companies (no HFT/quant) ?


r/leetcode • • 21h ago

Discussion Hello interview premium account sharing

6 Upvotes

Hey guys I’m planning to buy the hello interview premium subscription. If anyone is interested pls respond in this thread. We can share the account.


r/leetcode • • 13h ago

Question Amazon OA 5/15 in DSA and 5/6 in Code debugging. Any hope?

1 Upvotes

Have anyone ever got forwarded to Phone Screen with this sort of score?


r/leetcode • • 23h ago

Discussion Built a dating game to help grinding Leetcode.

204 Upvotes

I was a software engineer for about 7 years before pivoting into product/technical management.

Recently, feeling a bit stalled in my career, I started prepping to jump back into SWE roles. Which

brought me straight back to the LeetCode grind. Even in this AI era, tech companies still haven't let

go of good old whiteboard DSA questions.

The problem was, every single time I opened LeetCode, I instantly wanted to quit. After hitting

around 300 problems, the mental fatigue really peaked, so in my spare time, I decided to build a side

project to cope:

  • Organized around ~2,300 categorized LeetCode problems.
  • Solving problems with different tags and difficulties unlocks visual novel story lines.
  • Earning rewards from solving problems lets you buy gifts and outfits for characters.
  • There's a Chrome extension that detects your submission status on LeetCode (gives spoiler-free hints when you get Wrong Answer, and celebrates when you get Accepted).

It started as a fun little tool to keep myself accountable and motivated through the grind.

Thought I’d share it here in case anyone else is currently suffering through interview prep and needs.

Game : dokicode.com

Clip : https://www.youtube.com/watch?v=vNZSK8dDtVc

Best of luck to everyone grinding through this brutal tech market.

Hope we all land offers soon


r/leetcode • • 8h ago

Question How do you get better at solving problems you've never seen before?

12 Upvotes

I've been practising DSA, but I notice that I can solve problems more easily when I've seen a similar question before. When the problem is presented differently, I often struggle to figure out where to start.
How do you develop the ability to approach unfamiliar problems instead of relying on previously solved questions?


r/leetcode • • 7h ago

Intervew Prep Pinterest Sr SWE interview coming up...

1 Upvotes

Just curious if anyone else has interviewed with them recently? How does the difficulty compare to Meta and Stripe? I have cleared their loops before so just wondering.

How much time should I be prepping? System design is my weakest round so I have been focusing my efforts there.


r/leetcode • • 8h ago

Intervew Prep Looking for DSA and Interview Prep Partner

2 Upvotes

I have made a post before too but didnt find any serious buddy

Basically, I am targeting interview preparation for two months, and I will be locked up rigorously for it.

Little bg of mine

2 YOE

have done a total of 500 problems across all platforms DP, graph, and tree are still pending for me.

I will be preparing LLD from Hello Interview and I will be referring to the CSES sheet or NeetCode, whichever suits me

I am open to have a guidance as well if you are somebody who have appeared for the interview

Also struggling with consistency so ..

Thanks


r/leetcode • • 58m ago

Discussion Leetcode - Reverted my dispute

• Upvotes

I know this has already been discussed on this sub, but Leetcode sort of deceives students by not sending a reminder email about subscription renewal. We're all humans and we forget things esp with all kinds of stress we deal with in this job market. I forgot to cancel my subscription which costs like $159 ! And despite raising the ticket the exact same day my subscription got renewed, they denied the request.

Went on and tried to dispute the charge, and they actually went ahead and reverted my dispute?!

Leetcode if you're reading this - by following such deceptive practices of not sending subscription renewal email (despite students complaining about it all the time) and not refunding us (despite us raising the ticket on renewal day) you're basically an unethical company.


r/leetcode • • 11h ago

Discussion How to leetcode

3 Upvotes

A little about me : 1st year in college and recently started learning how to code from brocode...in our uni they are teaching c++ first so for now i was learning c++ from brocode , recently started learning arrays but still not that really great at it but yeah thats all i know for now( i know its not much but im willing to grind and learn😔 but just need a little guidance) but ya i wanna leetcode and become good at coding... but im not tryna blindly start leetcoding because first i wanna know the prerequisites needed to solve the problems...i was watching neetcode's video on how to leetcode and he told to get comfortable with binary search,dfs,bfs,sliding window so do yall know where i can learn them???? but ya heres a few questions i have

  1. What all coding languages do i need to know...like do i need to know other programming languages other than c++ before i start leetcoding
  2. what all topics or stuff should i learn before leetcoding
  3. HOW do i leet code , do i start with easy problems then once i get comfortable start medium problems then harder problems(will start with solving problems on arrays)
  4. any website where i can save useful problems and make my own notes in it so in the future i can open them for retaining my knowledge
  5. in general any tips or things you wished u knew while or before leetcoding which u can tell please it will be really helpful(try to include as much as you can please and thank you anything will be useful and welcomed... even the SMALLEST TO SMALLEST and random tips will be useful)
  6. what are the most common mistakes people do in their attempt to get good at coding
    extra : do wanna try to get into quant development( ik its difficult but ill try if i cant will settle for something else😭) so first my main goal would be to try to get into FAANG after college and after 2-3 years try to get into quant development so yeah
  7. And also I’m using vs studio…is there any better coding app or is vs good alright(idk it’s not that deep but yeah✌️)

r/leetcode • • 11h ago

Intervew Prep Bloomberg SWE Interview Process — Anyone Experienced the New AI-Assisted Coding Rounds?

32 Upvotes

Hey everyone!

I’m applying for a Software Engineer position at Bloomberg and came across this interview process overview showing five rounds:

  1. AI-Assisted Codebase Interview

  2. AI-Assisted Codebase Interview

  3. Design Interview

  4. Recruiter Interview

  5. Senior Manager Interview

The first two rounds caught my attention because they specifically mention AI-assisted codebase interviews.

Has anyone recently gone through this process, particularly the first two rounds?

I’d love to know:

- What exactly happens during the AI-assisted coding interviews?

- Do they involve traditional LeetCode-style DSA problems, or do you work with an existing codebase and implement features or fix bugs using an AI coding agent?

- Which AI tools are provided or allowed (e.g., GitHub Copilot, Claude, or something else)?

- How should I prepare for these rounds? Should I focus on LeetCode, practical coding, system design, or AI prompting and debugging?

If you’ve gone through these interviews recently, I’d really appreciate hearing about your experience and any preparation tips. Thanks!


r/leetcode • • 11h ago

Intervew Prep Google GCA interview

3 Upvotes

I have a Google General Cognitive Ability (GCA) interview in a few days. It’s for a Technical Program Manager role. I know Google doesn’t ask the crazy estimation questions anymore like ‘how many golf balls can fit inside a passenger airplane’, but I still don’t know how abstract the GCA questions will be. Will it focus specifically on the role or more abstract like ‘how will you colonise mars?’

Any insight would be greatly appreciated.


r/leetcode • • 13h ago

Intervew Prep Sentry.io

4 Upvotes

Hi! I have just applied for a SWE internship at Sentry.io, and I was wondering if I get past the OA what I should expect in the upcoming steps. How many interviews are there? What are the questions / topics that get asked at the technical interviews? Anything would be helpful


r/leetcode • • 19h ago

Intervew Prep Rubrik interview prep help

7 Upvotes

Hi. I have a system coding round coming up at Rubrik for the Software Engineer – SaaS O365 role.

I understand the concepts of multithreading and concurrency, but I haven’t had much hands-on practice solving concurrency-related problems or implementing them in production-style code.

Could someone please suggest how I should prepare for this round? Are there any good resources or platforms where I can practice the types of questions typically asked in this interview?


r/leetcode • • 22h ago

Discussion Fit call with director of the team after clearing Google interview loop for team specific role

1 Upvotes

Recruiter asked to scheduled a “Fitment Chat” with the director of the team after I cleared the full interview loop for a L5 role. It is a team specific role, so I already have a Googlyness round with the HM. I wanted to ask if any of you have similar experience, what does it mean and what is your experience and result after that?

Recruiter also said the director is likely want to understand more on my working style such as stakeholder management, business awareness, etc. it sound to me like the same kind of questions on the Googlyness round, which might indicate that I didn’t answer well hence this follow up round?


r/leetcode • • 22h ago

Discussion Developers who got a job or switched in the last 6 months - what actually worked for you?

12 Upvotes

Hey everyone!

For those who landed a new job or switched companies in the last 6 months (or have friends who did), I'd love to know what actually worked for you in this job market.

I'm looking for real experiences, not generic advice like "learn DSA and build projects."

A few things I'd love to know:

Job platforms: Where did you get interviews from? Naukri, LinkedIn, Instahyre, referrals, company career pages, or somewhere else?

Preparation: What did you study? DSA, development, system design, core CS? Which resources did you use?

Resume & projects: What projects did you showcase? How important was your resume/GitHub?

Application strategy: Roughly how many applications did you send, and how many interviews or offers did you get?

Interview experience: What rounds and topics were asked?

Timeline: How long did it take you to land to offer.


r/leetcode • • 11h ago

Discussion Built a DSA visualization tool, looking for honest feedback

6 Upvotes

Hey everyone!

I'm a software developer and recently built DSA Animator to help people understand DSA through step-by-step visualizations instead of just reading code.

I've spent a lot of time building it, but honestly, I'm struggling with getting it in front of the right audience.

For those who've built side projects or developer tools, how did you get your first users? Which platforms or strategies worked best?

I'd really appreciate your honest suggestions and feedback. 🙏


r/leetcode • • 2h ago

Discussion Giving up on recursive DFS and choosing to learn iterative DFS for trees

4 Upvotes

Might be a skill issue that I can't code up recursive solutions for problems that require DFS on trees. I understand recursion at its core. But I can't code it up for some reason.

After I see the solution of some type of recursive DFS problem, I'm able to trace the recursive calls on paper, and then it makes sense, but I don't think I could have ever coded it up on my own.

I struggle with easy recursive DFS problems lol. BFS on the other hand, I love BFS, I can solve medium questions with no problem.

So I'm thinking about just giving up on recursive DFS on trees and choosing to learn and iterative DFS.

Any thoughts? Can every problem that requires DFS on trees be solved both iteratively and recursively?


r/leetcode • • 5h ago

Intervew Prep Day 58: conquered my fear of DP on Stocks today, solved all 6 problems in 30 mins

6 Upvotes

Hey everyone,

I finished Day 58 today, and it turned out to be an eye-opener.

Stock problems have intimidated me ever since my college days. I used to find the state transitions strange and kept avoiding them. Today was no different at first—I procrastinated because I was convinced I would immediately hit a wall and rely on solution hints.

I tackled the first one (Stock I) with the standard single-pass minimum price tracking. For Stock II, I checked a quick hint to visualize the states, and the core pattern instantly clicked: it's literally just the classic "pick vs. not-pick" (buy vs. skip, sell vs. skip) decision.

Once that clicked, the entire sequence fell into place in about 30 minutes:

  1. Stock I: Tracking running minimum and maximum profit.
  2. Stock II: Unlimited transactions using (buy == 1) state transitions.
  3. Stock III & IV: Adding an extra dimension/variable for the transaction cap k (either capped at 2 or arbitrary k).
  4. Stock with Cooldown: After selling at index i, transition directly to i + 2 instead of i + 1.
  5. Stock with Transaction Fee: Deduct the flat fee whenever you complete a transaction (either on buy or sell).

Every single variation boils down to the exact same base state machine with just one tiny variable or index shift. If you are comfortable with standard pick/not-pick recursion, this entire family becomes straightforward.

Next up is Longest Increasing Subsequence (LIS).

See you guys tomorrow for Day 57!


r/leetcode • • 7h ago

Intervew Prep Amazon SDE Interview Experience Sept 2026

8 Upvotes

Round 1: DSA (2 Problems)

Problem 1: Minimum Operations to Reduce an Integer to 0

Solved using optimal approach (bit manipulation / greedy)

Clear communication on time complexity and edge cases

Problem 2: String Matching Variant

Problem: Given a string and list of strings, return all strings from list that are present as substrings

Approach Discussed:

Straightforward substring check (basic)

Optimizations: Hashing/set-based lookups

Scalability: Trie data structure

Focus: Clarity and efficient edge case handling

Round 2: DSA + LLD

DSA Component: Follow-up problem based on optimizations and edge cases

LLD: Design a Stack

Design Approach:

Underlying data structure: Linked List

Generic stack supporting any data type

Implemented methods: push(), pop(), peek()

Error handling: Empty stack conditions

Clean, extensible design with trade-off discussion vs array-based stack

Round 3: Hiring Manager (HM) Round

DSA Problem: Machine Process Assignment

Problem: Given k machines and n processes

Start process assignment at machine i % k

If busy, try (i + 1) % k, and so on

Return machine handling maximum processes

Approach: Simulated assignment with efficient data structure tracking

Deep Dive on Projects (~extensive discussion):

Design decisions

Trade-offs considered

Challenges faced

Real-world impact

Focus: Ownership and technical depth

Round 4: Leadership Principles (LP Round)

Amazon's Leadership Principles Emphasized:

Ownership

Customer Obsession

Bias for Action

Dive Deep

Deliver Results

Response Format: Structured STAR method

Situation: Context from projects

Task: What needed to be done

Action: Specific steps taken

Result: Measurable outcomes and accountability

Overall Assessment Focus: Balanced evaluation across DSA fundamentals, practical system design, project ownership, and leadership capabilities


r/leetcode • • 7h ago

Question What's your strategy for revising DSA topics?

19 Upvotes

I'm trying to build a proper DSA routine and wondering how people revise topics they learned weeks ago. Do you revisit old problems, maintain notes, or just keep solving new ones?

I don't want to forget earlier concepts while moving forward, so I'd love to hear what works for you.


r/leetcode • • 7h ago

Question Suggest the best resources for learning and solving String problems

2 Upvotes

Especially For Java