
Coding Interview Problems with Detailed Solutions, Test Cases, Program Analysis - hoanhan101
https://hoanhan101.github.io/2020/01/06/101-challenges
======
brenden2
Somewhat related: a while ago I went through a bunch of the "Cracking the
Coding Interview" problems and completed them in Rust, whilst recording most
of the coding for YouTube (until I got bored).

Here's the project: [https://github.com/brndnmtthws/cracking-the-coding-
interview...](https://github.com/brndnmtthws/cracking-the-coding-interview-
rust)

~~~
dijit
Wow, that's awesome I was literally just looking for something exactly like
this.

------
dingribanda
I have been prepping for almost 6 months now. I look at the stocks new hires
get at my company and what my refreshers are. Companies seem to be relying on
the fact, most people are too lazy to leetcode and will not give good
refreshers. I have been with the company long enough that leaving and coming
back atleast will add 600k to my earnings in the next 4 years. One thing
however though I notice, that my coding speed has improved a lot by doing
timed leetcode questions. I also look at the complexity of everything I write
far more than I used to. Overall it looks like a win, win for me. The moment
my company gave same level of stock as I would get in 2 years to a new college
hire, I have decided to move. I have been with the company for more than 18
years. It is possible it is my company that does this. I hear goog refreshers
are good.

~~~
johnwh
Although I absolutely hate it, I interview every 1 or 2 years and use it as
negotiation for refreshers. The only time I ever got a reasonable pay bump was
by showing I had alternative offers. On the other hand, you have to also be
willing to leave.

------
cjohnson318
I like using the Blum Mental Hash as an interview question. As far as I can
tell, it's not mentioned in any interview cram lists, and it's complex enough
to see how candidates split up a problem.

[https://scilogs.spektrum.de/hlf/mental-cryptography-and-
good...](https://scilogs.spektrum.de/hlf/mental-cryptography-and-good-
passwords/)

~~~
Waterluvian
That looks fun. Do you require them to know trivia or do you provide them with
the definition and ask for an implementation?

~~~
cjohnson318
I explain how it works first and then ask for an implementation. I look for
sane code organization, correctness, and an awareness of Pythonic idioms if
it's a Python heavy role.

------
songzme
It pains me to see another Coding Interview preparation tool. It's such a sad
situation in the current industry.

Students learn to game the system to get a high paying job. Students who care
about what they are working on will painstakingly try to perfect their
projects. They don't have time to game the system and therefore have a hard
time getting a coveted job.

Companies want to hire "the best" so they usually hire someone who can ace the
company's interview. People who can ace the company's interview are usually
those who studied for it.

I recently took over a codebase from an ex-employee who went to Google. People
were happy for him but I am so indignant. His code caused me hell. One
production bug after another led me to eventually throw out all of his code.
His code was written by somebody who did not care and his tests were useless.
I'm pretty sure during his time at our company he was focused on leetcoding so
he could get somewhere better. I wanted to reach out to him on LinkedIn to
give him a piece of my mind hoping it may make him a more responsible engineer
but I decided against it. I focused on fixing the features for the users
because it was the right thing to do.

I want to work with people who care about the product they are working on.
People who care about building great products are not solving coding interview
problems.

~~~
md2020
Currently a junior in a reasonably well-regarded (and difficult) CS program,
this is 100% how I feel. As a result of my genuine interest in the material
being taught and desire to do well on course projects, I do not have the time
or energy to be grinding Leetcode and HackerRank to the extent that I've read
others do. Yet every company I apply to will not even speak to you unless you
pass their brain-teaser-esque HackerRank problem, many of which are somewhat
ambiguous and have typos in the problem statement. It's infuriating and seems
like it only incentivizes the behavior you describe here.

~~~
songzme
I'm sorry you feel this way. The best advice I can come up with is, either
find a product space you care deeply about and see how far you can take it or
swim with the wave and start preparing for coding interviews.

~~~
md2020
Interestingly, the only places I've interviewed with that deviated from the
typical SV coding challenge interview have been the national labs (JPL, LANL,
Sandia, etc.). The questions they asked were much more focused on my interests
as well as evaluating my general software engineering skills. I did an
internship at one of them last year and it looks like I might be headed back
there this summer too. Hoping I don't get locked into the national labs scene
permanently.

------
mrbonner
The coding interview in our industry reminds me of a question on Quora I got
today. It asks if it is true that Richard Feynman only had a 125 IQ score. It
is the case. And it makes me wonder how much good those interview questions
are used to judge someone with a limited time. I know a few people in my
company were let go after 6 months albeit they did fabulous with those
interview questions.

~~~
seanmcdirmid
IQ is hard to measure, and it isn’t really clear what it represents anyways.
Metrics are always going to be incomplete, unlike in a litrpg.

------
RangerScience
Neat. I actually had a coding interview I got to skip because I'd already done
the exact same question for another company, and had done my original work in
Git+Github :)

Going through these and writing up solutions seems like a decent hobby
project, applicable to a lot of situations.

------
acconrad
Practicing for coding interviews are to FAANG companies what the SATs were for
the Ivy League.

It's not about how smart you are or how well you will do. It's about how good
you are at studying interview problems/the SAT. And even then it's a crap
shoot if your admission reviewer/interviewer was in a good mood that day.

As much as it's suboptimal/unfair/whatever your objection is, your options are
to not play the game (and miss out on the wealth of opportunity or cash) or to
dive on in and accept reality.

------
heyflyguy
some of these questions seem super easy, and then some of them have wording
that seems impossibly hard to comprehend.

------
vanusa
The fact that one can just ahead and cram for these problems should pretty
much... severely downgrade, at least, their usefulness as hiring filters.

~~~
banachtarski
Everyone always says this, but the fact remains that it _is_ a filter in the
sense that not everyone can learn it, or retain it. People always complain
that the techniques requested in an interview are not required for the job. I
see it in a different sense. The jobs they ultimately qualify for do not
require such skills.

~~~
vanusa
There's now doubt that these tests serve as some kind of "a" filter.

The question is, whether they serve as a particularly _good_ filter.

------
jointpdf
Does anyone have insight on the extent to which interviews for ‘data
scientist’ or ‘ML engineer’ roles involve Leetcode-esque or whiteboard coding
exercises? What is the norm (if any) for assessing coding and subject matter
competency for these sorts of roles?

~~~
Falcorian
It depends on the company and the role. In general, I would be prepared for
some white boarding questions, although I've found they're generally "a little
easier" than the ones the engineers whine about.

------
lazyant
in golang

~~~
haecceity
I think python is the most efficient language to use in interviews tbh.
Functional languages might be better depending on the problem but you don't
want people thinking you're a witch or something.

~~~
ayberk
I learned enough Python for the interview questions specifically for this.
Based on my (obviously anecdotal) experience, candidates I interview spend
considerably less time on actual coding when using Python.

That being said, Scala makes design questions much easier thanks to its type
system.

------
herval
The new trend in SF/bay area seems to be companies you’re applying to
preparing you _specifically_ for the questions they’ll ask. People realized no
one memorizes one specific search algorithm or puzzle, so they now tell you,
before the interview, that you’ll be asked problems A, B and C.

Not “algorithm problems” or “search” - “we’ll ask you to revert a doubly
linked list”.

It’s bizarre.

~~~
chris11
Where have you seen that? The most I've been given is a general interview prep
guide about how to prepare for an on-site.

~~~
herval
2 “FAANG” companies and another one of the top big tech ones. One had a
recruiter calling and literally listing all the questions they “could ask”,
coding, architecture and all. They asked all of them.

~~~
mgkimsal
I don't think it's the companies themselves as much as the recruiters. I've
had recruiters pump me for info on the specifics of the question asked, and I
obliged. I was younger and naive, and... didn't understand what they were
doing. Not until later, when the reverse happened to me - I was given
"potential" questions to prep for (which... I already knew answers to because
it was my regular day job for) that I understood why I'd been asked about that
stuff before.

~~~
paxys
You are implying that FAANG recruiters are doing this without the knowledge or
consent of the hiring team, which is ridiculous.

~~~
scarface74
If recruiters are incentivized by a metric of how many candidates get through
the process, why wouldn’t they do that without the consent of the hiring team?

External recruiters do that all of the time. I worked with the same recruiter
when I was trying to get a job and when I was hiring through him. I knew he
prepped candidates so I had to have a different set of interview questions and
different coding interview tests (with an IDE on a computer).

I know of one company where the hiring manager had all of the candidates do a
merge sort on the board. He used the same interview question for years. All of
the recruiters knew what to prep their candidates for.

