One of FANG | Jul 2019 [Reject] - lesson learned to never fail again

Originally this message was a comment under a Clayton's Wong post:
https://leetcode.com/discuss/interview-experience/424540/google-l5-mtv-oct-2019-offer
which swiftly became hot in leetcode community recently.
This message contains my personal experience and beliefs that I'm applying to learn data structures
and algorithms in leetcode.com since I got a rejection from one of FANG after interviewing with them onsite.
I decided to repost it here so maybe someone can find it useful.

My background:
4.5 years of learning programming and working as fullstack software engineer, comming
from a completely unrelated to engineering field. (have a Bachelour of Law degree from some
mediocre university in Ukraine)
Had interview with one of FANG this summer in Hong Kong but failed it due to the fact that I suck in DSA.
After failure I reviewed my approach on learning algorithms and data structures. Below you can read
what I do since then. I believe the approach that I describe here may be interesting to you if you
struggle to find a right way to learn DSA. I also believe it will help me to succed in my next
interview with top tech companies.

I strongly agree with Clayton that in order to succeed at DSA interviews you need to be in an
Autonomous stage of knowing algorithms and data structures. Also, you should know the code
of their efficient implementation in your favourite language.
It is not an easy thing to achieve and only way to get it is a daily hard work on memorizing
solutions for tasks and actual code memorizing. I know some of you may not like the idea of
memorizing a solution and it may look boring, but in my opinion it is the only way to enable
your brain to solve programming problems. I also mean that while memorizing you ought to
understand the solution and algorithm you are using, not just relying on your visual memory of
code snippets or so on.

I grabbed this idea from Clean Coder book and since then I do my every day Coding Katas.
It is like Katas in Karate or some other eastern martial arts. You need to train your problem
solving "muscle" by everyday practicing in order to be efficient when time comes: at interview.
So when you discover some new interesting problem, after solving it and looking at others
solutions and finding most optimal and clean code, you may put it on a list in one of your daily
Coding Katas.

Following the advise from a book, I've been already doing my Coding Katas for several months
and I'm feeling it really makes a lot of difference. I'm becoming better at problem solving.
Everyday I have 2 - 3 problems to reherse. If I have enough time for repetition I'm practicing
it on paper first then retyping it to IDE.
Note: when practicing code on paper you may use some readable abbreviations to reduce time
you spend on writing long function names or classnames by your hand. Because it is really slower then
typing a code. As we all know some languages may be too verbal, as Java for example, and as practice
shows interviewers are ok if you make some reasonable abbreviations of class names and functions
during whiteboard coding interview. But make sure you let them know that you are using abbreviatins
to reduce time spend on writing them on whiteboard! It will be a plus for you during interview.
Examples of abbreviations I use with Java: HashMap -> HM, String -> Str.
You may use even something as .indexOf() -> .idx() if you agree with interviewier to use such
abbreviation for saving time. Most important, the code structure should remain the same as in your
language of choice. Don't think that your nasty pseudocode will be accepted during your interview :)
This is mentioned in a book: Cracking Coding Interview.
By the way, also do mention that you write a readable code usually with readable function names
and variables as a production code! No one wants a team meber who writes cryptic code with var names
such as x or y and function names do() and so on. Remember to mention that you are only doing
it as an exception for whiteboard coding.

I'm also following the idea I grabbed from this article: https://fs.blog/2018/12/spacing-effect/
The idea is the same as in learning new foreign language words. It works like word cards
repetition with intervals (like in memrise.com or anki). Some of you who learned foreign
language may already know that this method is efficient and proved in practice. The idea of
interval repetition is backed up by Hermann Ebbinghaus (1850-1909). He was a German
psychologist and pioneer of quantitative memory research. It is ground up on a fact that when
you are repeating one concept over and over with deep understanding of it, we are making strong
neuron connections in our brain. And it becomes easier for us to remember it, so yes you can be
autonomous in programming problems solving! Don't beleive it? Look at the videos of top leetcode
contest winners in youtube. They are like problem solving machines :)

I'm also using an Android app called Let's Review! (no free analog for iphone that i know) which
has a feature of reminding you your reviews for today, with your own set intervals. I'm doing
1-3-10-30-60 days intervals, according to article, and if say 30 days later I couldn't remember a
solution or made a mistake while repeating it on paper, I'm putting it on list from the day 1,
to make sure it is being remembered for good. There are some days I don't retype code in leetcode,
but I do practice it on paper at least.

Now I don't claim that you can become top coder at leetcode contests if you follow this method.
But it will help you to gain sufficient knowledge to get your dream job at top companies. After all it is
not all about your tech skills, it is also about your soft skills, and you can read a Soft Skills book by
John Sonmez to know more how to develop and maintain them.

Also to be successfull in your interview on a top of your strong DSA background, you should be also
keen using SOLID principles of OOP design in practice (autonomous coding of these concepts as you
wish) and know how to design efficient systems. But this is a whole different story not for this post :)

For a good free course on Algorithms, I recommend Princeton's series on coursera.com and you can
find and downlload their book for free online if you search well.

EDIT 1: As @vluu commented, you should not memorize the code untill you fully understand the
algorithm. I actually meant the same in this post but it appeared not clear. So to make sure you
get the message correct: learn algorithms concept first before memorizing the code.
Princeton's Course at coursera.com and their book is already a good start. They cover the most
important algorithms nowadays. You should understand a concept of algorithm and several different
applications of it to fully master it. Or in other words you should:

  1. Understand algorithm.
  2. Solve several problems using this algorithm in your language of choice.
  3. Make sure you can always reproduce the code and algorithm concept when it is needed. (in other
    words make shure it is in your Autonomous toolkit)
  4. The more problems you've practiced solving using a specific algorithm, the better chance you have
    to solve a new problem that you've never encountered.
  5. Diversify your knowledge of algorithms. What I mean by that is that you don't have to focus on
    solving linked lists problems for a month or so, add new type of algorithm as a new problem to solve
    next time. This way you will keep it fun and more productive by challanging yoursefl with new problems.

EDIT 2: as @thesourav has asked some recommendations on using Let's Review! app here are
some tips.

  • I use 1-3-10-30-60 days interval pattern. You can set your own intervals pattern in the app settings.
    Also you can play around with interface it is a bit sparse and confusing, but best try yourself
  • Make a priority list of algorithms and problems that you want to memorize. These are going to be
    your katas. You can add them one by one as long as you get a free spot in a day. For example you may have days
    when you don't have any reviews for today.
  • Before adding problem for review make sure you learn algorithm first then solve problem with it.
    If you struggle to solve problem it simply means that you don't know the algorithm to solve it. There is
    no point to keep trying to solve problem for weeks. Jut find some good youtube video with good
    explanation of solution and deeply understand it.
  • After you learned it and understood the solved the problem and found most optimal code by
    comparing your code with code from discussions settings, add it to your review loop in the Let's
    Review app.
  • You can learn with your own pace, don't have crazy goals like: I'm 22 and I just started learning
    programming. I suck in DSA but I will work hard to be the best top leetcoder in 3 months.
    This is insane! :)
  • Try to add at least one or two more new problems/algorithms for review every 2 or 3
    days. The app will automatically remind you if you turn on notifications.
    This will keep you busy.

EDIT: 3 I've actually followed Clayton's advice to have a look at this free course:
https://www.coursera.org/learn/learning-how-to-learn
and it is really useful. I found the spacing effect I've descripbed in this post is also mentioned in
this course, but there are also more useful tips you can grab from there on being able to learn
efficiently.
The course may look too simple. But suprisingly there are no such courses at regular schools. Here
are some bulletpoints I grabbed from this course:

  • I saw many examples of people that I've met who simply didn't know that overlearning doesn't make
    any better.
  • You need to take a break if you already learned a lot of information, because
    overloading of you brain with a lot of cognitive load doesn't make any help to progress.
  • Also a lot of interesting tips about chunking concept into small bits of information.
  • Good sleep is good for your brain and learning ability.
    These simple tips and more can be found in that course!

General tips (but not less important):

  • Keep work-time, learn-time and life-time balance. If you are at work where you do long hours, think is your
    live worth it? Are you happy? Maybe you should a find better place to work where you can enjoy your free time more? The same applies for
    study. Keep it all in balance. Usually the most healthy sacrifice you can make to develop a new habit
    is to cut off some time you spend with your friends or watching tv/youtube :) I don't mean you should
    become unsocial but maybe you can spend less time partying or hanging out without seeming to be a
    boring nerd?
  • Eat good an healthy food.
  • Do excercising, at least two times per week.
  • Have a walk in a park or better in the forest, or along a beach. Have some mindful moments, give
    your brain some rest rest.
  • Have a good sleep EVERY day. (at least 6-8 hours for normal human)
  • Certainly alcohol, drugs, tabacco or any other stimulators (except coffee maybe) will NOT help you to learn faster.
    So make sure you don't have these bad habits. If you have them, you'd better put it as a priority to get
    rid of them first. If you have friends who influence you to have bad habits, find other friends who don't
    have them and leave your old toxic social connections behind.
  • Don't blame yourself for mistakes you've made in a past. Learn from them.

Thank you all for your attention!

I'm gonna go to a park now listening some audio book and after I get back home I'll do some leedcode problems and algos reviews ;)

Maybe some of you may apply my method in your DSA learning experience.
Wish you all good luck!

Paul

Comments (11)