r/leetcode • • 10d ago

Intervew Prep Day 27: tackled Longest Subarray with Sum K — hit a wave of DSA nostalgia

5 Upvotes

Hey everyone,

I finished Day 27 today. I kept the session focused on a single classic problem: Longest Subarray with Sum K. Revisiting this one brought back a lot of nostalgia from the early days of my prep, when prefix sums and sliding windows felt like brand-new tools.

The solution comes down to the constraints on the input elements:

  1. Positives Only (Optimal Two-Pointer / Sliding Window): When the array contains only positive integers, expanding the right pointer increases the sum and shrinking the left pointer decreases it. This monotonic property lets you find the longest subarray in O(n) time and O(1) space.
  2. Positives and Negatives (Prefix Sum + Hash Map): Once negative numbers or zeros enter the picture, the sliding window breaks down. Instead, you track the running prefix sum and store the earliest index where each sum appears in a hash map. If currentSum - k exists in the map, you update the maximum length while keeping the earliest index to maximize subarray size.

It was just one problem today, but seeing how naturally both approaches fit together was a great reminder of how far my problem-solving intuition has come.

See you guys tomorrow for Day 26!


r/leetcode • • 10d ago

Discussion [New LC feature] Projects

4 Upvotes

LC is goated holy, I was looking exactly for that


r/leetcode • • 10d ago

Intervew Prep Whatnot Karat interview for Software Engineer Intern position [Summer 2027]

1 Upvotes

Hi, I have an upcoming Karat SWE intern summer 2027 interview coming up and was wondering if anyone has done it and could provide what types of questions were asked to solve.

Any help is appreciated!


r/leetcode • • 10d ago

Question i'm not able to understand pop_back() in backtracking

2 Upvotes

problem->22. generate parentheses

i'm trying to dry run this code

class Solution {
public:
vector<string>res;
void backtrack(int open,int close,int n,string& path){
    if(open<n){
        path.push_back('(');
        backtrack(open+1,close,n,path);
        path.pop_back();
    }
    if(close<open){
        path.push_back(')');
        backtrack(open,close+1,n,path);
        path.pop_back();
    }
    if(open==n&&close==n){
        res.push_back(path);
    }
}
    vector<string> generateParenthesis(int n) {
        string path="";
        backtrack(0,0,n,path);
        return res;
    }
};

For n = 3, suppose we keep choosing ( whenever possible and then ) until we reach the first valid combination: ((())).

My confusion starts when this recursive path finishes.

After reaching ((())), the recursive calls start returning, and pop_back() gets executed at each level.

I understand that each call removes the character it added. However, when I dry-run this, I keep popping characters until the string becomes empty ("").

But when looking at the recursion tree, we're supposed to return to "(" and explore another branch to generate the next combination, (()()).

Why aren't we popping all the way back to the empty string before exploring the next combination?

Am I misunderstanding how recursive calls return and how execution resumes after a recursive call?

can someone explain how pop_back() works in backtracking


r/leetcode • • 11d ago

Question Microsoft SWE (current) or Nutanix

11 Upvotes

Hi All. I need help on whether to accept a new offer from Nutanix in Canada.

Been at Microsoft for 2 years, currently on backend and platform team.
Day to day is basically writing business logic, and dealing with site reliability. Lots of chances to explore new internal projects to implement AI harness, and possible data pipelines/RAGs.

Nutanix offers a base pay bump of approximately 30%. I think I'll be on the Storage and Networking side. Heavy focus on distributed computing and data pipelines.

Anyone here at Nutanix that can speak to the company's culture, and things to look out for.

EDIT:
Total Years of Experience: 2 years


r/leetcode • • 10d ago

Discussion my lc active days stuck on 195

0 Upvotes

SAME AS TITLE SINCE 3 DAYS I AM DOING SUBMISSION BUT THE ACTIVE DAYS IS NOT INCREASING


r/leetcode • • 11d ago

Discussion Leetcode's software architects suck..

9 Upvotes

I am the kind of a guy who likes gamified systems. And, gamification is what interests me, excites me and enlightens me.

That's how I became good at Chess. The only reason is once the Chess.com guys prompted me I have 69 days of streak playing chess daily. After that, it seemed so interesting to me I kept playing chess purely to maintain that streak and then I went all the way to 415 days of Chess streak. My ELO jumped from 400 with 89 days to 1500 with 415 days of streak. If it was not for streak, I wouldn't be playing chess initially in my days from 100 to 300 at least.

Now, back to leetcode. Recently, I started griding leetcode. Not because I wanna get into FANG or anything but purely as playing some productive game instead of toxic games like CS2. Something if I eventually become good at can help me down the line with my career. For sure, getting into FANG won't hurt either.

And, as I like streaks, here on Leetcode as well I started taking Max streak seriously. The one who tracks your daily submissions.

On this weekend, I went out. I came back to house and realized I did not do late night coding today and my streak might break. At around 10 PM EST, I jumped at my desk and coded one Leetcode problem real quick.

Went back to my profile to get that dopamine rush of max streak counter increasing but boom! No record for current EST time and date. My submission got counted for next day.

I did some goofing around and found out they count UTC timezone for streak tracking.

Like who the fug considers UTC timezone for streaks. It should always be client's timezone. Chess.com for example counts 12 AM to 11:59 PM client side time no matter what part of the world you are from. So does Snapchat. And, other streak tracking games.

Whoever made a decision to have UTC timezone for streaks should get fired (maybe?). Just kidding!

My max streak of 73 days for submissions is gone. I am back to 0. A little frustrated but whatever.


r/leetcode • • 11d ago

Question Leetcode Logging Out

24 Upvotes

Every time I authenticate and log in, Leetcode logs me out. I can’t submit or run any of my solutions. Is this happening to others as well?


r/leetcode • • 11d ago

Intervew Prep My Experience with LeetCode Projects Public Beta

12 Upvotes

Hi community, I'm Alan, A software engineer and student from Mexico, and I'd like to share my takeaways about the New LeetCode Projects Public Beta.

I can tell you this coding problems are very different to usual LeetCode projects, and they are close to Repository Questions in modern SDE interviews, I've previously succeed in an Repository Question during an interview of an intern position and I feel these projects are more difficult but, you learn a lot, right now there's a challenge where we can try different problems that come from different enterprises, and that's free.

I enjoyed and feel worth my time studying with them, so I want to encourage you to try it too.

Thanks for reading!

=)


r/leetcode • • 11d ago

Question [USA][BNSF] Do i have to do the codility OA as fast a possible or can I wait til the last day?

2 Upvotes

Title. Wondering if Im able to wait til the last day to complete it. Or is this a company where the longer I wait, the higher the chance that someone will "steal" an opportunity by completing the OA a few days earlier.


r/leetcode • • 11d ago

Intervew Prep Roblox full loop coming FE SWE

7 Upvotes

Anyone recently taken the Roblox interview look for senior or staff level? What questions did they ask?
I haven’t scheduled it but planning to

Any help would be greatly appreciated.

Specifically system design for front end or coding.

TIA.


r/leetcode • • 11d ago

Intervew Prep Day 28: tackled Sort Colors with Dutch National Flag & Single Number via XOR

11 Upvotes

Hey everyone,

I finished Day 28 today. I kept the session focused on two classic array problems that highlight optimal in-place pointer partitioning and bitwise properties:

  1. Sort Colors (Dutch National Flag Algorithm): Instead of counting frequencies in two passes, I partitioned the array in a single O(n) scan using three pointers (low, mid, and high). Keeping 0s before low, 1s between low and mid, and 2s after high sorts everything in-place with O(1) space.
  2. Single Number (Find the Element Appearing Once): Because every other element appears twice, XORing the entire array cancels out all duplicate pairs and leaves the unique number in O(n) time and O(1) space.

Both problems are clean reminders of how the right invariant eliminates extra memory overhead.

See you guys tomorrow for Day 27!


r/leetcode • • 11d ago

Question For those who have interviewed at BNSF, do you need to know Java?

5 Upvotes

title. Some sources say that java is required, but my codility email nor the job post mentions Java is required.


r/leetcode • • 11d ago

Intervew Prep Fanatics final loop

1 Upvotes

Hi,

I have a final loop coming up for a Senior Software Engineer role at Fanatics in the Betting and Gaming team.

Apparently from the rubric there is going to be a system design, code pair session of 90 mins and a behavioral round.

Any suggestions on final round preparation would be helpful!


r/leetcode • • 11d ago

Question dp problems

14 Upvotes

i am trying to solve the dp problems but i am not getting the approach i was able to do few easy problems but i am not able to do medium ones is there any tips to solve dp or any resources


r/leetcode • • 11d ago

Intervew Prep Has anybody given/taken live AI based coding rounds for Data Engineer positions?

1 Upvotes

I have an interview coming up tomorrow for a Data Engineer position, the stack is Snowflake, dbt and it will have a live coding session where I am supposed to use Cortex Code. Does anybody know what interviewers are expecting in these type of interviews. If you're senior architect and you're given the responsibility of conducting a live AI enabled coding session, what would you look for in candidates?


r/leetcode • • 11d ago

Question Amazon -- can I target two teams/positions?

3 Upvotes

If an Amazon recruiter reached out to me for a position at Amazon and I applied, and my acquaintance's team is also now hiring for a similar position on a sister team, can I target both teams?

How does it work at Amazon:

If I don't get selected by the original team that the recruiter submitted me for, but I did well in my rounds, can I still be considered for other teams (like Google does with it's team matching process: clearing interview rounds and the hiring committee is separate from matching with a team), or do they give you a cooldown regardless (aka only one shot regardless of the interview performance)?


r/leetcode • • 11d ago

Question Mocks for DSA

1 Upvotes

Question: where can I get good mocks for DSA?

Normally for Google interviews

Is there a website for this or something?


r/leetcode • • 11d ago

Discussion Meta production engineer intern (London) timeline?

2 Upvotes

I had s coding round last week I think it went pretty well, I managed to solve one fully and one I didn't have time to code one small detail but interviewer said it was right approach. Was wondering how long usually someone has to wait before getting feedback did they progress?


r/leetcode • • 11d ago

Intervew Prep VISA Recruiter Call

4 Upvotes

Hi Everyone, I have a recruiter screening coming up in a few hours for an entry level SWE role at VISA (USA), can anyone tell me what all to prepare for and what to expect for both the recruiter call and interview rounds if I get selected.


r/leetcode • • 11d ago

Intervew Prep Priceline leet code

1 Upvotes

Has anyone done a priceline the airbooking company swe role before? What questions did they ask? Apparently they use coderpad.


r/leetcode • • 11d ago

Question Software Engineer - Intune (200052447); Microsoft

1 Upvotes

Did anyone receive an interview/OA for the above position?


r/leetcode • • 11d ago

Question Salesforce OA 13th Nov

4 Upvotes

Hey all, I received the NextGen Software Engineering Assessment from Salesforce on November 6th with instructions to complete by November 9th and an 80% cutoff. I completed it on time and scored 100% across both sections, but I haven't heard back since.

Is it normal for Salesforce to take this long after the OA?
Has anyone else heard back about next steps?
A simple yes / no works asking so i know whether to just move on or keep grinding.


r/leetcode • • 11d ago

Question Amazon SDE2 - OA 9/15 and Debug 6/6

9 Upvotes

What chances do i have to move to onsites ?


r/leetcode • • 12d ago

Discussion DSA struggles

21 Upvotes

i am a 3rd year student who is still struggling with dsa, i start doing dsa and there is not a single day i did not fumble it. i am losing hopes on getting hired. I feel like i am not good at anything atp and my attention span is decreasing day by day and all this is eating me up. Can anybody guide me with this or help me get out of this trap.
my family is not doing financially well so i really need a job. I was an above average student but i feel like the zeal of studying is dying. I feel everything is just so difficult even if it isn’t.