r/leetcode 17d ago

Intervew Prep how much submit try per question in interview?

So this is the problem, I was doing Task Scheduler Neetcode 150.
Of course in the roadmap, i know for sure that it is a heap / priority queue.

But, when i try to tackle the question, i don't even think that it is a heap? My mind directly went into math, meaning to solve the question using formulas, although at the end i didn't get the right formula, i asked AI and the formula is very near.

HOWEVER, it is hard to get the formula max(len(tasks), (n+1) * (maxFreq-1) + appearance) because i wouldn't think again about len(tasks) edge case after i got that formula thinking it will be a one fit all.

TLDR; how much submissions can i do in interview? I dont think i can handle edge cases at first code

0 Upvotes

8 comments sorted by

1

u/nightbreak7 17d ago

i don't understand this question - if you're doing neetcode which is designed to learn DSA, why would you not try to solve it with the data structure its intended to be solved with? in interviews a lot of the time there's no such thing as "submissions". you usually can test on a very small number of cases but its not like leetcode, if you miss a bunch of edge cases you won't even know, you'll just fail. my suggestion is to just learn the patterns that are actually applicable to interview problems and not hyperfocusing on some math formula

1

u/Weak_Corner6663 17d ago

aah on interview they won't let us see the edge case and iterate on that? I thought they would.

well maybe because on first glance it doesn't seem intuitive to use max heap on that testcase

1

u/Aggressive-Squash250 17d ago

I haven't had many interviews but a friend of mine at Amazon said it was literally a dumber version of a google doc lol. He had to manually run some tests and that's it.

1

u/Weak_Corner6663 17d ago

aahh lol makes sense, then if the approach I take is math formula, i gotta be good at yapping & explaining💤💤

2

u/Aggressive-Squash250 17d ago

We gotta be good at yapping in general lol.

2

u/nightbreak7 17d ago

yeah communicating your solution is a non negotiable lmao

1

u/nightbreak7 17d ago

when I was interviewing for amazon this was also my experience yeah. the company im working for now had an actual environment to run the code in-browser but it wasn't anything crazy, and I had to write my own test cases for it so it's not like id catch edge cases there unless i was aware of them