<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Interview tips - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Interview tips - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 09 May 2026 14:05:56 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/interview-tips/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Prepare for Technical Job Interviews –  Based on My Experience Landing a Job ]]>
                </title>
                <description>
                    <![CDATA[ Hi, I’m Ilyas. I’m a web developer, and this is my story about how I struggled with interviews for a long time and what finally helped me break through. I’ll talk about what failing basic interview questions taught me about recall, preparation, and s... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-prepare-for-technical-job-interviews-based-on-my-experience-landing-a-job/</link>
                <guid isPermaLink="false">694c23da6c9dee59dd506fea</guid>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ interview preparations ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Junior developer  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ career advice ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ interview ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ilyas Seisov ]]>
                </dc:creator>
                <pubDate>Wed, 24 Dec 2025 17:33:14 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1766597367293/515dd71a-fb65-4508-bdd2-39b103ddb438.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Hi, I’m Ilyas. I’m a web developer, and this is my story about how I struggled with interviews for a long time and what finally helped me break through. I’ll talk about what failing basic interview questions taught me about recall, preparation, and smarter job searching.</p>
<p>If you’re a junior, mid-level, or self-taught developer who keeps getting rejected and you don’t fully understand why, I hope this helps.</p>
<p>Here’s what I’ll cover:</p>
<ol>
<li><p><a class="post-section-overview" href="#heading-my-18-month-job-search-struggle">My 18-Month Job Search Struggle</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-interview-problem-i-didnt-expect">The Interview Problem I Didn’t Expect</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-discovering-active-recall-and-flashcards">Discovering Active Recall and Flashcards</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-my-interview-preparation-system">My Interview Preparation System</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-results">The Results</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-changing-how-i-looked-for-jobs">Changing How I Looked for Jobs</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-turning-my-system-into-a-small-tool">Turning My System Into a Small Tool</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-lessons-i-learned">Lessons I learned</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-final-thoughts">Final Thoughts</a></p>
</li>
</ol>
<h2 id="heading-my-18-month-job-search-struggle">My 18-Month Job Search Struggle</h2>
<p>For 18 months, I was trying to land a remote or relocation web developer job.</p>
<p>During that time:</p>
<ul>
<li><p>I applied to more than 1,000 positions</p>
</li>
<li><p>I went through around 20–30 interviews</p>
</li>
<li><p>I failed most of them</p>
</li>
</ul>
<p>It was exhausting. I felt like I was putting in a lot of effort but getting almost no results. Over time, I started doubting my skills and wondering whether I would ever find a job I’d actually be satisfied with.</p>
<p>What made this even more confusing was that a few years earlier, in 2021, I had found a remote job at a US company in just three weeks – with almost no experience</p>
<p>Something clearly wasn’t working anymore.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1766404237516/f3465911-0d09-458b-9dd6-a91ee03524cf.jpeg" alt="real screenshot from one my unsuccessful interviews from Turing.com" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-the-interview-problem-i-didnt-expect">The Interview Problem I Didn’t Expect</h2>
<p>After dozens of interviews, I noticed a pattern: I wasn’t failing because I couldn’t solve complex algorithm problems or build features under pressure. I was failing on basic technical questions.</p>
<p>Questions like:</p>
<ul>
<li><p><strong>“What are portals in React?”</strong></p>
</li>
<li><p><strong>“Can you explain how an HTTP GET request works?”</strong></p>
</li>
</ul>
<p>These were not hard questions. They were things I had learned before. But during interviews, under pressure, <strong>I just couldn’t recall.</strong> Or simply I skipped it during preparation because there were no systems in place.</p>
<p>That’s when I realized the real issue: I didn’t have a problem understanding concepts. I had a problem recalling them quickly.</p>
<p>My first instinct was to study more. More tutorials, more articles, more videos.</p>
<p>But passive learning didn’t fix the problem. I still froze during interviews. What I actually needed was a way to <strong>train my memory</strong>, not just consume information.</p>
<h2 id="heading-discovering-active-recall-and-flashcards">Discovering Active Recall and Flashcards</h2>
<p>That’s when I came across flashcards and the concept of <strong>active recall</strong>.</p>
<p>Active recall means testing yourself repeatedly on what you’ve learned instead of just rereading material. You try to answer a question from memory first, then check the answer. This approach has been backed by research for more than a century.</p>
<p>I started practicing small, specific concepts this way, like:</p>
<ul>
<li><p>React fundamentals</p>
</li>
<li><p>JavaScript basics</p>
</li>
<li><p>HTTP methods</p>
</li>
<li><p>Browser behavior</p>
</li>
</ul>
<p>I repeated them until recalling the answer felt automatic.</p>
<p>This made a huge difference during interviews.</p>
<p>Flashcards help you cut through the noise and actually learn what matters. It's not just about memorizing facts – it's about really understanding, remembering fast, and building a solid base in every concept you study.</p>
<p>So to help you prepare for your interviews, I’ve taken years of experience and scientific learning methods and turned them into a tool and approach that gives you the right info at the right time.</p>
<h2 id="heading-my-interview-preparation-system">My Interview Preparation System</h2>
<p>Once I found the right learning method, I built a simple system around it.</p>
<h3 id="heading-step-1-ask-what-to-prepare-for">Step 1: Ask What to Prepare For</h3>
<p>Instead of guessing what to study, I started asking recruiters directly:</p>
<blockquote>
<p>“What topics should I prepare for the technical interview?”</p>
</blockquote>
<p>Surprisingly, many of them replied with a clear list, which helped me focus only on what actually mattered and avoid over-preparing random topics. In my experience, many HR reps are quite helpful to job applicants.</p>
<p>For example, when I applied for a position as a Frontend Web Developer in React, the HR specialist advised me to focus mainly on React and JavaScript. So I prepared for all the popular questions around hoisting (JS), the event loop (JS), how react works under the hood, what props are and how they work, and so on.</p>
<p>Overall, that interview went well – but when I got a question on React Portals, I couldn’t explain it properly. And so I didn’t get the position. But I don’t blame myself for this one, as that’s a very rare topic. 😊</p>
<p>I also applied for another Front End Developer role where the HR specialist advised me to prepare mainly for questions about GSAP, Framer Motion, and React/Next JS. This made sense, as the company mainly builds modern animated websites.</p>
<p>In my interview, the theory round went well, but I failed the take home assignment. I realized then that I didn’t have enough skills in these areas.</p>
<p>At another company, I asked HR about the cultural interview, which was the last round. The rep said: ”<em>No worries, all the hard work is done from your side. Prep for just a human dialog.</em>”</p>
<p>And for the last application I submitted (and after which I actually got the job offer), the HR specialist told me to strongly prepare for CSS – especially Flexbox and Grid<strong>.</strong> This made sense, as the position was for an HTML markup developer. And so I practiced all the ins and outs for these topics, even the more rare ones.</p>
<p>I use the same approach for each round of interviews.</p>
<h3 id="heading-step-2-use-flashcards-with-ai-carefully">Step 2: Use Flashcards (With AI Carefully)</h3>
<p>I used ChatGPT to generate flashcards for each topic and reviewed them daily.</p>
<p>One important thing I learned: <strong>AI can be wrong sometimes.</strong> To reduce mistakes, I started adding links to official documentation in my prompts so the answers were grounded in reliable sources.</p>
<p>I kept sessions short and consistent. That consistency mattered more than long study sessions.</p>
<blockquote>
<p><strong>AI mistakes</strong> was the reason I created <a target="_blank" href="https://99cards.dev/">99cards.dev</a></p>
</blockquote>
<p>Here is the prompt I use in ChatGPT:</p>
<p><em>You are a web development expert with 20 years of experience. Your task is to help me to prepare for the interview.</em></p>
<p><em>Prepare 10 flashcards on CSS Flexbox topics. Format one question with four answers. One answer is correct.</em></p>
<p><em>You're going to serve all the questions one by one. After I answer, you give me feedback and then give me the next question.</em></p>
<p>Note that you should tweak your prompts for your needs, and based on what you need to review.</p>
<p>You can experiment with various factors, such as:</p>
<ul>
<li><p><strong>Difficulty:</strong> beginner or advanced</p>
</li>
<li><p><strong>Specificity:</strong> from vague (for example: I want to practice with CSS) to highly specific (for example: I want to practice with the flex property in CSS Flexbox)</p>
</li>
<li><p><strong>Number of questions:</strong> sweet spot is between 10 and 20</p>
</li>
<li><p><strong>Add context:</strong> good practice is to add links to official docs, as it decreases the chances of AI hallucination</p>
</li>
</ul>
<p>Here is a typical flashcard created by ChatGPT:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1766489222813/57a6b0eb-de79-46a3-89d6-aaeeeffdf04e.png" alt="flashcard created with ChatGPT" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>If you provide an answer, you’ll get feedback like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1766489282577/910c04a0-6f2a-4304-9f39-3644b2c40bd9.png" alt="feedback by ChatGPT" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-the-results">The Results</h2>
<p>After a few weeks, interviews felt very different.</p>
<p>I was calmer. I answered basic questions without panicking. I could explain concepts clearly and confidently.</p>
<p>In my final interview process, I passed four rounds in a row and scored 95% on the technical test.</p>
<p>Soon after, I received an offer: $5,500 per month and a paid relocation package for my family and me.</p>
<p>For the first time in a long while, my effort finally matched the results.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1766404662077/70e690b2-6fd0-448c-a83e-456ab1b12555.jpeg" alt="screenshot of job offer" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-changing-how-i-looked-for-jobs">Changing How I Looked for Jobs</h2>
<p>About six weeks before getting the offer, I also changed <strong>where</strong> I searched for jobs.</p>
<p>Instead of relying only on large job platforms, I started using smaller communities like Telegram job groups.</p>
<p>This helped for two reasons:</p>
<ol>
<li><p><strong>Less competition</strong>: many smaller companies post roles there with fewer applicants</p>
</li>
<li><p><strong>Direct communication</strong>: I could message recruiters before applying</p>
</li>
</ol>
<p>Before submitting an application, I would ask:</p>
<blockquote>
<p>“I saw this position. Here’s my CV and LinkedIn. Am I a good fit?”</p>
</blockquote>
<p>If the answer was yes, I applied. If not, I moved on immediately.</p>
<p>This saved me a lot of time and energy.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1766404678028/9e6a2452-2c6c-48b8-8494-629742865a70.png" alt="job groups in Telegram" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-turning-my-system-into-a-small-tool">Turning My System Into a Small Tool</h2>
<p>While preparing for interviews, I created thousands of flashcards for myself. Managing them in notes became difficult, so I eventually turned them into a small tool called <a target="_blank" href="https://99cards.dev/"><strong>99cards.dev</strong></a>.</p>
<p>It’s simply a collection of fact-checked web development flashcards grouped by topic, based on the same approach that helped me stop failing basic interview questions.</p>
<p>Here are some screenshots from the app:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1766490090653/a54606f6-91d1-4302-8f39-15fa6d2d26a6.png" alt="99cards.dev - UI screenshots" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-lessons-i-learned">Lessons I Learned</h2>
<p>Here are a few takeaways from this experience:</p>
<ul>
<li><p>Failing interviews doesn’t always mean you lack skills</p>
</li>
<li><p>Passive learning is not enough for interview prep</p>
</li>
<li><p>Being able to recall basics quickly matters a lot</p>
</li>
<li><p>Job searching is a skill, not just a numbers game</p>
</li>
<li><p>Consistency beats cramming every time</p>
</li>
</ul>
<h2 id="heading-final-thoughts">Final Thoughts</h2>
<p>If you’re struggling with interviews right now, especially as a junior, mid-level, or self-taught developer, don’t assume you’re bad at what you do.</p>
<p>In my case, the problem wasn’t effort or talent. It was preparation and approach.</p>
<p>I also created a <a target="_blank" href="https://99cards.dev/checklists"><strong>free interview checklist</strong></a> based on my experience, covering HR, technical, behavioral, system design, live coding, take-home tasks, algorithms, and cultural fit.</p>
<p>I hope this story saves you some time and stress.</p>
<p>You’re often just one good interview away.<br>— Ilyas</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Developer Interview Prep – How to Use a Collaborative Approach to Problem-Solving ]]>
                </title>
                <description>
                    <![CDATA[ By Alberto Gonzalez Rosales No matter how experienced of a developer you are, being interviewed for a new job is always stressful. This is certainly true from my own experience.  In my case, I have been working professionally as a Software Developer ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/collaborative-problem-solving-with-python/</link>
                <guid isPermaLink="false">66d45d5b55db48792eed3f03</guid>
                
                    <category>
                        <![CDATA[ Collaboration ]]>
                    </category>
                
                    <category>
                        <![CDATA[ interview questions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 19 Apr 2023 21:14:37 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/04/michal-czyz-ALM7RNZuDH8-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Alberto Gonzalez Rosales</p>
<p>No matter how experienced of a developer you are, being interviewed for a new job is always stressful. This is certainly true from my own experience. </p>
<p>In my case, I have been working professionally as a Software Developer for two and a half years, and I've had to face developer interviews five times already.</p>
<p>I have seen people focus too much on learning specific algorithmic problems, or training in online platforms specialized in interview challenges. But there is another side to interviews which I think is as important – and people pay less attention to it.</p>
<p>So, if you want to know how I think you should focus your training for interviews, grab a cup of coffee and get comfortable.</p>
<p>It's going to be a bit of a ride ride (but don't worry – Python examples included!).</p>
<h2 id="heading-heres-what-well-cover">Here's what we'll cover:</h2>
<ol>
<li><a class="post-section-overview" href="#heading-do-algorithms-and-data-structures-matter-for-interviews">Do algorithms and data structures matter for interviews?</a></li>
<li><a class="post-section-overview" href="#heading-focus-on-a-collaborative-approach">Focus on a collaborative approach</a></li>
<li><a class="post-section-overview" href="#heading-try-doing-a-mock-interview">Try doing a mock interview</a><br>– <a class="post-section-overview" href="#heading-the-initial-example-interview-problem">The initial example interview problem</a><br>– <a class="post-section-overview" href="#heading-the-second-example-interview-problem">The second example interview problem</a><br>– <a class="post-section-overview" href="#heading-the-hardest-example-interview-problem">The hardest example interview problem</a></li>
<li><a class="post-section-overview" href="#heading-final-words">Final words</a></li>
</ol>
<p>Let's dive in.</p>
<h2 id="heading-do-algorithms-and-data-structures-matter-for-interviews"><strong>Do Algorithms and Data Structures Matter for Interviews?</strong></h2>
<p>The short answer is <strong>Yes</strong>.</p>
<p>Knowing about Data Structures and Algorithms will often help you get a job. Also, the benefits of having a solid algorithmic background include the capacity to make better decisions when faced with a challenging problem.</p>
<p>In real life, algorithmic problems won't appear like the statements in the academic exercises you might study. Still, the more trained you are the most likely you are to be able to recognize an application of a Balanced Binary Tree or a Shortest Path algorithm in disguise.</p>
<p>With this in mind, I would recommend not training Data Structures and Algorithms solely for the interviews that you want to excel at. The design of algorithms and how to use the right data structures are topics beautiful enough to be studied just for the pleasure of knowing.</p>
<p>The scope of an interview is very limited. Instead, focus on the problem-solving part of the issue. Try to understand how to use an algorithm (or variations of it) for similar tasks. Study all the variants, and learn to recognize them in different situations. This will help you face new tasks with an open mind.</p>
<p>Also, don't memorize solutions. It won't take you anywhere. It is very easy for an experienced developer to ask the right questions that will put you on display if you only train for very specific topics.</p>
<p>Take a problem and try to solve it using different methods. Try to solve harder problems every time. Get out of your comfort zone.</p>
<p>It will pay off.</p>
<h2 id="heading-focus-on-a-collaborative-approach"><strong>Focus on a Collaborative Approach</strong></h2>
<p>Most people train for their interviews on websites like <a target="_blank" href="https://leetcode.com/">Leetcode</a>. There is no problem with that. These websites are good for training your problem-solving skills.</p>
<p>I have been participating in Competitive Programming contests for the last eight years at least, and I have always benefited from these online resources.</p>
<p>But there is one thing that's hard to understand for most software engineers wanting to perform well in an interview. They don't train for the most important aspect of software development: <strong>Collaboration</strong>.</p>
<p>Usually, when you are faced with a problem in an online platform, it comes with some constraints on the maximum values for some input. It also might have some time and memory limits that require you to adjust your solutions to be more or less efficient. But this is not how it will be in real life.</p>
<p>It is not obvious how to map these constraints to real-life scenarios. They usually come in the form of very specific requests from a client, or very specific characteristics of the team.</p>
<p>In a real project, the team will <strong>collaborate</strong> to determine what these constraints will be. You have to analyze your use cases, the time you have for the task, who is the final user, how many people will be working on it, and so on...</p>
<p>After a series of discussions, you will reach a consensus and finally start implementing a solution that suits your needs. And this solution doesn't even have to be the more efficient in some cases, but the fastest to implement, for example.</p>
<p>This is what interviewers want to see from candidates during the interviews as well.</p>
<p>You don't jump straight to implementing the best solution you know for the problem you are facing. Instead, you should use your interviewers as a valuable resource, treat them as if they were your teammates (in the end, you want them to be). Ask questions about how the team prefers the solution for the problem to be implemented.</p>
<p>This will lead to a very fruitful discussion where you can showcase your coding abilities and your collaborative skills. You could start proposing simple solutions and walk your interviewers through the process of how the solution can be improved using the best Aces up your sleeve.</p>
<p>As a final note on online training, I would recommend doing individual and team training. Use websites such as <a target="_blank" href="https://codeforces.com/">Codeforces</a> or <a target="_blank" href="https://atcoder.jp/">AtCoder</a>, which have a huge set of interesting (and challenging) problems, and try to compete against yourself every day.</p>
<p>Don't focus on your rating. I have done that before, and it only holds you back.</p>
<h2 id="heading-try-doing-a-mock-interview"><strong>Try Doing a Mock Interview</strong></h2>
<p>If you reached this point in the article, I would like to propose a little exercise. Let's have a mock interview where I will act as the interviewer. I will tell you how I think the candidate (you) should answer every question and perform each task.</p>
<p>Of course, we will focus only on the programming challenge part. Other aspects of interviews, such as talking about previous experiences, are also important, but we will try to cover that in another article.</p>
<p>So, if you feel ready enough, let's go!</p>
<h3 id="heading-the-initial-example-interview-problem">The Initial Example Interview Problem</h3>
<p>Let's start with the task that you will be solving. Keep in mind that if you and I are ever in this situation, I won't be using this same example, but of course, I will be using the same methodology 😉.</p>
<p>The statement of the problem is the following:</p>
<blockquote>
<p>"Given an integer number <code>X</code>, find out if it is a prime number."</p>
</blockquote>
<p>You might be tempted to go for the best solution you know to solve this problem. I think that this approach, as I explained before, isn't always correct.</p>
<p>Instead, what I would like to know are the different approaches to solving this problem. Also, I would like you to ask about the requirements for this task. Something like:</p>
<ul>
<li>Should we aim for performance or to solve it faster?</li>
<li>Should we make a solution that is easy to understand for other developers?</li>
</ul>
<p>Usually, some aspects to consider when creating the first solution for a problem are:</p>
<ul>
<li>Easy vs Hard: Should we make an easy-to-implement solution even if it is not perfect, or should we go for a more robust solution that will be difficult to implement?</li>
<li>Naïve vs Efficient: Should we deliver a working, naïve solution first and then a more efficient one, or should we go straight to efficient?</li>
</ul>
<p>Evaluate what your team wants to optimize for. Reach a consensus, and implement the agreed solution.</p>
<p>In my case, I would be glad if you proposed the easiest, fastest-to-implement, correct solution that you can think of and then guide me through the process of how to improve that solution. </p>
<p>An example of a very good initial solution to this problem is something like the following:</p>
<pre><code class="lang-python"><span class="hljs-comment"># naive.py</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_prime</span>(<span class="hljs-params">x: int</span>) -&gt; bool:</span>
    <span class="hljs-keyword">if</span> x <span class="hljs-keyword">in</span> [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]:
        <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">2</span>, x):
        <span class="hljs-keyword">if</span> x % i == <span class="hljs-number">0</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">True</span>
</code></pre>
<p>As you can see, this function is correct. Since a prime number is an integer only divisible by the number <code>1</code> and itself, it makes sense to iterate from <code>2</code> to <code>x - 1</code> looking for a divisor of <code>x</code>. If we find one, we can immediately return <code>False</code>. Otherwise, we return <code>True</code>. As edge cases, the numbers <code>0</code> and <code>1</code> are not prime by definition.</p>
<p>This is a good starting point!</p>
<p>Now, before diving into optimizing this method, you can discuss the style of the code. Is it Pythonic enough? Do we care about it? Is it readable?</p>
<p>All these questions might not seem important at first but, since we work as a team, they do matter. Having a coding style is important because it makes it easier for every team member to understand each other's code, and it will speed up reviews and refactoring. Also, the code is more often read than written, so readability counts!</p>
<p>You might be tempted to show off your Python skills and rewrite the previous function as follows:</p>
<pre><code class="lang-python"><span class="hljs-comment"># pythonic_naive.py</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_prime</span>(<span class="hljs-params">x: int</span>) -&gt; bool:</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span> <span class="hljs-keyword">if</span> x <span class="hljs-keyword">in</span> {<span class="hljs-number">0</span>, <span class="hljs-number">1</span>} <span class="hljs-keyword">else</span> all(x % i != <span class="hljs-number">0</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">2</span>, x))
</code></pre>
<p>I think this is a good, pythonic way to write this function. But, since the team is the most important thing here, this change should be discussed.</p>
<p>It might be the case that some team members are not so skilled in Python. Maybe, in this case, we should optimize for readability instead and keep the function as we first wrote it.</p>
<p>A more interesting addition, before getting into performance, would be adding docstrings to the function. As I said before, this code is most likely to be read by your team members in the future. It is important, then, to make it easier for them (and your future self) to understand what this function is doing.</p>
<p>Maybe changing the function to something like the following will add more value:</p>
<pre><code class="lang-python"><span class="hljs-comment"># naive.py</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_prime</span>(<span class="hljs-params">x: int</span>) -&gt; bool:</span>
    <span class="hljs-string">"""This function takes an integer `x` as
    argument and checks whether is prime or not.

    Args:
        x (int): The integer number to test for primality.

    Returns:
        bool: True if the number `x` is prime, False otherwise.
    """</span>
    <span class="hljs-keyword">if</span> x <span class="hljs-keyword">in</span> [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]:
        <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">2</span>, x):
        <span class="hljs-keyword">if</span> x % i == <span class="hljs-number">0</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">True</span>
</code></pre>
<h4 id="heading-first-optimization">First Optimization</h4>
<p>Until this point, we have an initial solution that works. We have discussed important topics such as code styling, readability, and documentation for developers. These are all important things to consider when working as a team.</p>
<p>But we still haven't talked about the performance of the solution! So, it's probably time for that.</p>
<p>At this moment, you should probably bring up that this function can be implemented so it runs much faster. And now is when you showcase all that algorithmic knowledge inside you.</p>
<p>The previous solution has a time complexity of <code>O(x)</code>, where <code>x</code> is the input integer the function takes as an argument. This can be optimized to <code>O(sqrt(x))</code> with the following code:</p>
<pre><code class="lang-python"><span class="hljs-comment"># sqrt.py</span>

<span class="hljs-keyword">import</span> math

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_prime</span>(<span class="hljs-params">x: int</span>) -&gt; bool:</span>
    <span class="hljs-keyword">if</span> x <span class="hljs-keyword">in</span> [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]:
        <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">2</span>, int(math.sqrt(x)) + <span class="hljs-number">1</span>):
        <span class="hljs-keyword">if</span> x % i == <span class="hljs-number">0</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">True</span>
</code></pre>
<p>Or even like this, without importing the <code>math</code> library:</p>
<pre><code class="lang-python"><span class="hljs-comment"># sqrt.py</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_prime</span>(<span class="hljs-params">x: int</span>) -&gt; bool:</span>
    <span class="hljs-keyword">if</span> x <span class="hljs-keyword">in</span> [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]:
        <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
    i = <span class="hljs-number">2</span>
    <span class="hljs-keyword">while</span> i**<span class="hljs-number">2</span> &lt;= x:
        <span class="hljs-keyword">if</span> x % i == <span class="hljs-number">0</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
        i += <span class="hljs-number">1</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">True</span>
</code></pre>
<p>I would be ok with either alternative.</p>
<p>I omitted the docstrings in the previous implementation for the sake of making the actual code changes clearer. But, it would be great to include the time complexity of the function in the documentation for developers. The more information you can give about your code, the better it will be for your team members and yourself.</p>
<p>You are doing great so far. Let's continue!</p>
<h3 id="heading-the-second-example-interview-problem">The Second Example Interview Problem</h3>
<p>So far, I have been able to evaluate that you have the necessary collaborative skills to take on easy tasks with the team. Now it's time to complicate things a little.</p>
<p>This is the statement of the second problem I would propose:</p>
<blockquote>
<p>"Given two integer numbers <code>L</code> and <code>R</code>, count how many prime integers are in the interval <code>[L, R]</code>."</p>
</blockquote>
<p>Once again, I would recommend discussing what priorities the team has set regarding this task. Start simple and walk through the process of improving an initial solution. Emphasize that premature optimization is not a good practice.</p>
<p>Also, discuss the possibility of using the solution that you implemented for the previous task to solve this one. It makes sense that if we have a function that tells whether an integer is a prime number or not we can use it for every number in a range.</p>
<p>And this is something that you will have to do in real life. Usually, when a new task shows up, the team should look into the maintained projects to see what can be reused to speed up the implementation process. If you don't do this, you might end up coding duplicated functionalities.</p>
<p>That being said, a good initial solution for this task could be something like this:</p>
<pre><code class="lang-python"><span class="hljs-comment"># range_primes.py</span>

<span class="hljs-keyword">from</span> sqrt <span class="hljs-keyword">import</span> is_prime

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">count_primes</span>(<span class="hljs-params">l: int, r: int</span>) -&gt; int:</span>
    primes = <span class="hljs-number">0</span>
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(l, r + <span class="hljs-number">1</span>):
        <span class="hljs-keyword">if</span> is_prime(i):
            primes += <span class="hljs-number">1</span>
    <span class="hljs-keyword">return</span> primes
</code></pre>
<p>This is perfectly fine, and you have shown that you can reuse previous functionality to build new ones. As in the first example, you might be tempted to show off your Python skills and write this function like this:</p>
<pre><code class="lang-python"><span class="hljs-comment"># range_primes.py</span>

<span class="hljs-keyword">from</span> sqrt <span class="hljs-keyword">import</span> is_prime

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">count_primes</span>(<span class="hljs-params">l: int, r: int</span>) -&gt; int:</span>
    <span class="hljs-keyword">return</span> sum(bool(is_prime(i)) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(l, r + <span class="hljs-number">1</span>))
</code></pre>
<p>I recommend not going for this Pythonic implementation as your first option. Leave it for discussion, evaluate the readability of the code, and maybe analyze the differences in performance. Don't forget the docstrings!</p>
<p>The next section is when things get interesting. Keep reading. We are on the final step...</p>
<h3 id="heading-the-hardest-example-interview-problem">The Hardest Example Interview Problem</h3>
<p>Remember when I said previously that the constraints present in competitive programming websites are hard to map to real-life requirements?</p>
<p>Here is how I would present a difficult challenge for you to determine those constraints and implement the best solution that you can:</p>
<blockquote>
<p>"Suppose a client wants us to provide the functionality of calculating prime numbers in a range as a service. They want the focus to be on performance because they plan to use this service very often. How would you implement it?"</p>
</blockquote>
<p>If you have been practicing your algorithmic skills for interviews, you have probably solved problems similar to this one a few times. The main difference here is the change in context.</p>
<p>Instead of giving you precise instructions, numeric constraints, and input or output formats, I gave you a broader description of the task. And my goal here is the same as before: get you to interact with me as if we were teammates figuring out how to solve this problem from the little information we know.</p>
<p>Hopefully, after exchanging a few questions and answers, we can translate the previous, more ambiguous statement into something much more familiar:</p>
<blockquote>
<p>"Given a set of queries of the form <code>[L, R]</code>, answer, for each query, how many integer numbers inside that range are prime."</p>
</blockquote>
<p>And this makes sense because the client wanted to use this service very often, as stated in the description.</p>
<p>We want to focus on performance. That should be our main concern when implementing the solution. But still, the best way to get to an optimal solution is to start with a simple one, analyze if we meet our performance requirements, and keep improving gradually. Let's see the entire example.</p>
<p>We could start by using the solution we implemented in the previous step. Is it good enough?</p>
<p>Let's assume that the maximum range of numbers we will have as an argument to our function is <code>[1, 10^6]</code>. Also, realistically, let's assume that the number of queries our service will answer per minute is around <code>10^5</code>.</p>
<p>Our previous solution has a time complexity of <code>O(sqrt(n))</code> to determine if a number is a prime. If we were to do that for every number in the range, the complexity goes up to <code>O(n * sqrt(n))</code>. On top of that, if we do that for every query, we will end up with an even higher time complexity of <code>O(q * n * sqrt(n))</code>.</p>
<p>Substitute the previous variables with the highest possible values they can have, and you will get that this solution will take around <code>10^14</code> operations to answer all the queries. Assuming that a computer can perform around <code>10^8</code> elementary operations per second, it will take approximately <code>10^6</code> seconds to complete all of them.</p>
<blockquote>
<p>Note: Convert 10^6 seconds to days. You will be amazed 🤯.</p>
</blockquote>
<p>This solution is unfeasible if the goal is to prioritize the performance of our solution. Let's see how we can improve it.</p>
<p>At this point, what I would expect is for you to take out the best of the training that you've had on all those online platforms, and show me an impressive solution. This is the time to showcase all your analytical and algorithmic skills.</p>
<p>But only now, because I know that you are a team player.</p>
<h4 id="heading-the-final-solution">The Final Solution</h4>
<p>Since this is a mock interview, I am very interested in knowing your approach to solving this last problem efficiently. Let me know how you would implement the solution or share your code on GitHub – don't be shy.</p>
<p>I guarantee you one thing: if you can make it to this point in real interviews, probably it won't matter too much if you don't know the optimal solution to this problem. It doesn't mean that you shouldn't try your best to solve it, but rest assured that you have done a very good job already.</p>
<p>That's it! Now I want to see your code.</p>
<h2 id="heading-final-words"><strong>Final Words</strong></h2>
<p>In this article, I tried to summarize some of the aspects I consider to be the most important in coding interviews. I placed special emphasis on the collaborative part because I think most people underestimate how important this skill is. It is a must, especially if you want to work on a team with other developers.</p>
<p>I tried to guide you through a mock interview where I explained the thought process I would follow when faced with a standard coding task in an interview. I hope this exercise was useful and that it can help you in your next interview (as a candidate or as an interviewer).</p>
<p>Share your thoughts on this mock interview, and let's start a fruitful discussion.</p>
<p>See you soon! 👋</p>
<h2 id="heading-sources"><strong>Sources</strong></h2>
<ul>
<li>Code examples used in the article can be found <a target="_blank" href="https://github.com/albexl/a-problem-solving-oriented-approach">here</a>.</li>
<li>Hint for the last problem: implementation of the <a target="_blank" href="https://github.com/albexl/data-structures-for-teaching/blob/dev/algorithms/number_theory/eratosthenes_sieve.py">Sieve of Eratosthenes</a> algorithm.</li>
</ul>
<p>👋 Hello, I'm Alberto, Software Developer at <a target="_blank" href="https://dowhile.se/">doWhile</a>, Competitive Programmer, Teacher, and Fitness Enthusiast.</p>
<p>🧡 If you liked this article, consider sharing it.</p>
<p>🔗 <a target="_blank" href="https://bio.link/albexl">All links</a> | <a target="_blank" href="https://twitter.com/albe_xl">Twitter</a> | <a target="_blank" href="https://www.linkedin.com/in/albexl/">LinkedIn</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Coding Interview Prep for Big Tech (FAANG) – And How I Became A Google Engineer ]]>
                </title>
                <description>
                    <![CDATA[ When I changed careers from lawyer to software engineer at Google, I published 10 big ideas that helped me make that massive transition. Since then I’ve had a ton of questions from people asking me questions about: How I taught myself new skills Ho... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/coding-interview-prep-for-big-tech/</link>
                <guid isPermaLink="false">66d461c933b83c4378a51861</guid>
                
                    <category>
                        <![CDATA[ career advice ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Career Change ]]>
                    </category>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Zubin Pratap ]]>
                </dc:creator>
                <pubDate>Wed, 13 Jul 2022 14:45:30 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/07/Google-Mel.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>When I changed careers from lawyer to software engineer at Google, I published <a target="_blank" href="https://www.freecodecamp.org/news/from-lawyer-to-google-engineer/">10 big ideas that helped me</a> make that massive transition. Since then I’ve had a ton of questions from people asking me questions about:</p>
<ul>
<li><p>How I taught myself new skills</p>
</li>
<li><p>How did I know that learning to code at 37 was not “too late”</p>
</li>
<li><p>How I prepared for big tech coding interviews</p>
</li>
<li><p>How I analyzed and minimized the risk of career change</p>
</li>
<li><p>How I worked out that software engineering was “right” for me</p>
</li>
<li><p>What languages I focused on</p>
</li>
<li><p>Whether being a FANG/FAMGA software engineer is right for everybody (hint: tempting to think so but I saw plenty of evidence of it not being right for some people’s goals)</p>
</li>
</ul>
<p>Note: I think “FAANG/FAMGA” is limiting, and prefer to refer to “big tech”since there are many highly prestigious companies other than the usual 4-5 everyone obsesses about.</p>
<h2 id="heading-why-i-wrote-this-article">Why I Wrote This Article</h2>
<p>Each of those questions I listed above deserve their own article, even though I know our contemporary culture prefers “tweet-sized tips”. However, meaningful skills can’t be internalized from a few hundred characters.</p>
<p>So today I am going to share with you my answer to one of those questions – the approach I adopted when:</p>
<ol>
<li><p>I made that first jump in careers from lawyer to coder at 38, and</p>
</li>
<li><p>How I prepared for big tech interviews at the ripe ol’ age of 39, with less than 2 years of coding behind me.</p>
</li>
</ol>
<p>If you want me to write on any of the other questions I always get, please let me know! I’m going to put my contact details in this post somewhere, and the only way to find it will be to go through the article. 😊 That is also to encourage you to carefully read this article rather than skimming for a “quick tip”.</p>
<h2 id="heading-uncovering-the-real-goal">Uncovering the Real Goal</h2>
<p>I hold the following opinions: getting coding interviews is harder than learning to code. Doing well at the interviews is often just as hard as getting the interviews. Behavioral interviews are hard if you don’t have solid experience – but your competition does.</p>
<p>When I made the switch I had zero coding background. Later, when I set my sights on Big Tech, I knew I’d be competing with PhDs, people who’d been coding since their teens (often 20+ years), and folks who'd achieved a lot more technically than I had in my one brief year’s experience as a developer.</p>
<p>And I had the added challenge of applying for big tech from outside the United States.</p>
<p>So I had to develop a plan that went well beyond just “learning to code”.</p>
<p>First, let me explain why I concluded that “learning to code” is the easy part, even though I’d tried and failed to learn to code 4 times, between 2012 and 2018.</p>
<p>This insight came to me in late 2018, when my startup was struggling. I had lost tens of thousands of dollars building my startup. I had no income for over 2 years.</p>
<p>And I decided to pull out over $40K from my mortgage. Why? I got into a top-rated bootcamp in San Francisco.</p>
<p>I left my family behind, and relocated to the US. I was meant to be there for over 14 weeks, but I withdrew from this top-rated bootcamp in week 1, and returned to Australia.</p>
<p>I had been super excited about the adventure (and scared from all the debt). But I developed grave doubts about the bootcamp strategy. I noticed that my instructors and the program were designed to help people "learn to code" rather than "becoming a coder".</p>
<p>From my experience on the hiring side in 3 other industries and 4 countries, I knew this was a mistake.</p>
<p>Learning to code is just a form of “literacy”. And literacy is not skill.</p>
<p>I was living proof: each of the 4 times I focused on “learning to code” I succeeded in a narrow sense. Whether it was HTML or Java or writing a simple Android app from a book, I always succeeded at learning how to read and write the basics. But I had no idea how to actually build anything useful. I was completely hopeless at applying my knowledge – I had no real “skill”.</p>
<p>In this century we don't get hired for what we know. We get hired for skill.</p>
<p>I quickly saw several reasons why a coding bootcamp was the wrong strategy for me.</p>
<p>This expensive bootcamp would likely give me some basic skills, the kind that may even get me an “entry level” job. But I could see things were going to be rushed, standardized, and focused on "getting out the other end".</p>
<p>I didn't want to "tick a box". I wanted skill. Competence. Confidence.</p>
<p>Moreover, bootcamps seemed to prepare everyone for entry level "junior developer" jobs.</p>
<p>I was 37 and I didn’t want to settle for an “entry-level job” mindset. Plus I don't believe anyone with 3 + years of experience is "junior" even if they're a total newbie in the field.</p>
<p>Then I discovered that several instructors and teaching assistants at the bootcamp were former students who hadn’t yet found jobs. They had never changed careers – many had never had a "career" as such. The job-search counselors had never even been on the interviewing side in tech.</p>
<p>How was I going to learn to do something from people who’d never done what I needed to do?</p>
<p>And then there was geography. Students based in San Francisco had advantages, whereas people coming from other parts of the US did not find work that easily and ran out of money in the long months after graduating and before getting their first job. Heck, I was based in Australia...how was this going to work for me?</p>
<p>I looked at my explicit goal. It was not to "learn to code" – it was to build a career that fulfilled me.</p>
<p>Plus, when researching bootcamps, I could see a path to learning “part time”. That seemed like a much more sustainable strategy to me because I could find a job and learn at night and on weekends. After over 2 years of no income, I needed to have cashflow in order to keep fear at bay, and focus on becoming a professional coder.</p>
<p>As the legendary businessman Harvey Firestone said:</p>
<blockquote>
<p><em>“Having a surplus is the greatest aid to business judgment that I know.”</em></p>
</blockquote>
<p>Having income while studying would give me the confidence to make better judgments. Better judgments are important for a career that is fulfilling in the long term.</p>
<p>I had no doubt that I would "learn to code" if I did 3-4 months in the bootcamp.</p>
<p>But would I learn enough for a good team to pay me money for my skills? I no longer believed bootcamps and online coding websites would help me achieve that.</p>
<p>Learning to code would not get me far. I had to be good enough to beat my competitors who had coding degrees, prior experience and networks. I wanted a career in code.</p>
<p>So I left the bootcamp, wrote off about $9,000 and returned to Australia. Sure, I had gained rudimentary coding literacy to pass the entrance test for the bootcamp. But I was very far from competent.</p>
<p>This analysis may be hard to understand if you’re new to the workplace. Another way to truly understand it is to notice that many of us play music, but aren’t in a band. As my mentor said:</p>
<blockquote>
<p><em>"Michael Jordan didn’t want to learn to play basketball. He wanted to be in the NBA. Huge difference."</em></p>
</blockquote>
<h2 id="heading-how-to-use-your-advantages-amp-disadvantages">How to Use Your Advantages &amp; Disadvantages</h2>
<p>That one insight made all the difference. Within 8 months, in 2019, I got all 4 developer jobs I applied for. I simply followed the program I’d developed with the help of my (non-technical!) coach.</p>
<p>Don't be misled though. I had unexpected advantages. I benefited from 2 major advantages that initially appeared to be disadvantages.</p>
<p>This was not my first career change, and for almost a decade, I had been on the hiring side in previous careers. Today I’ve been on the hiring side in engineering too, and the patterns are very similar.</p>
<p>My biggest advantage was that I was no longer thinking about the job market challenge as a candidate. I was thinking about this from the perspective of the hiring manager. That had a significant impact on my plan because I had experience of how hiring managers think – their constraints, priorities, values, business needs, dislikes, red flags...</p>
<p>My experience (age?) helped me understand what impact I could deliver to a team and organization, and to identify the right people that I could learn from, who could help me with ideas, guidance, suggestions and referrals. What was a disadvantage was now an advantage – <a target="_blank" href="https://www.freecodecamp.org/news/why-career-changers-have-an-advantage/">a career changer's advantage</a>.</p>
<p>On the point of advantages, I want to call out something important.</p>
<p>The easiest thing in the world is to dismiss others for having “killer” advantages. It's easy to shrug and say "Of course – that’s why they succeeded". It’s easy to not notice that everyone has very compelling and serious disadvantages.</p>
<p>For me, my “disadvantages” were:</p>
<ul>
<li><p>Geography – I don’t live in the US or one of the other tech hubs</p>
</li>
<li><p>No formal computer science qualifications</p>
</li>
<li><p>Zero technical background</p>
</li>
<li><p>A mortgage and financial responsibilities</p>
</li>
<li><p>My “age” – learning new skills when you’re pushing 40 is harder than when you’re 25</p>
</li>
<li><p>Cultural and social expectations, judgment, negativity</p>
</li>
<li><p>Recruiters and bosses being younger than I was and uncertain of how to deal with me</p>
</li>
<li><p>Compared to other candidates, people viewed my change as very, very “risky”</p>
</li>
<li><p>I was going to earn less in engineering than I would as a lawyer</p>
</li>
</ul>
<p>Every day I hear from people who let any one of these things stop them. While I cannot comment on whether or not they’re real reasons, I <em>can</em> say that if we argue for our limitations, we get to keep them.</p>
<p>Clinging on to our disadvantages does not help us overcome them.</p>
<p>With the help of my coach and a ton of mindset/psychology training, I was able to dig into my disadvantages and convert a few of them (not many!) into major advantages. And that’s when I realized that my experience with how interviewing, recruitment, and resourcing works would help me a lot in formulating a strategy.</p>
<h3 id="heading-priority-one-career-change">Priority one: career change</h3>
<p>When learning to code and intentionally setting the goal of becoming a professional coder, I found that I kept switching to short-term thinking and obsessing about my first role.</p>
<p>I wanted my first role to be glorious, to prove all my critics wrong, to pay me a gazillion dollars and save me from having to deal with self doubt and struggle for the rest of my life.</p>
<p>But I had to train myself to view things differently. My first role must be one that makes me learn and grow, and set me up for future success no matter what happened. It needed to pay fair market rates, but I was happy to take a slightly lower salary if the team was fantastic and the growth/learning was solid. It did <em>not</em> need to be my dream job.</p>
<p>I was very explicit in the tradeoffs I’d make:</p>
<ul>
<li><p>Team matters more than brand</p>
</li>
<li><p>Team matters more than money</p>
</li>
<li><p>Brand matters more than money (as it would set me up for future opportunities)</p>
</li>
<li><p>Money matters more than stock (this was for my first dev role, as this would make my continued learning plan sustainable, even though stock may give me more financial upside)</p>
</li>
<li><p>But, learning mattered more than brand or money – as learning more would save me time which is better than saving me money</p>
</li>
<li><p>I would not trade off between team and learning. I needed both (but I was more likely to get reliable signals on the team than I would on the actual learning/growth I’d get on the job)</p>
</li>
</ul>
<p>“Nailing it” or being comfortable was not a priority. My priority was to successfully change careers.</p>
<p>Accepting a rubbish coding job (and there are plenty of them…) would not be a “successful” career change for me. But equally I didn’t have to get into big tech (ever) for my career change to be “successful”. This was very personal – success to me meant loving the work I do and learning a lot doing it. Period.</p>
<h3 id="heading-how-i-made-a-customized-plan">How I Made a Customized Plan</h3>
<p>After analyzing my advantages and "convertible" disadvantages, the next thing I needed to develop was a customized plan. I needed one that was tailored to me, that I could believe in.</p>
<p>I needed a plan that took into account my specific context, which includes my temperament, experience, beliefs, values, goals and skills.</p>
<p>Note that I’ve still not talked about the technical interviews, the algorithms and data structures, and so on. When developing my plan, I had to focus on all the many pieces that had nothing to do with my coding skills or technical capability.</p>
<p>It would also need to account for my psychological “runway” – how much time was I prepared to invest in this career change, before I’d give up, lose hope, or change my mind? I could not answer that without understanding how long it was going to take me to learn the minimum required skills.</p>
<p>To understand that, I needed to research and analyze what the minimum set of engineering skills that the market would value were.</p>
<p>And to understand that, I needed to analyze the dozens of engineering domains in the market, and which ones would suit my temperament, interest/passion and advantages. And from that analysis I’d need to pick the domains that I would focus on and exclude all others.</p>
<p>I'd have to find the overlap between my interests, my ability and what the market valued.</p>
<p>Again, my experience on the hiring side of the market gave me some (small but important) advantages. I knew that pure technical skill would not be enough – that’s just the starting point. the “invitation to the dance”.</p>
<p>I also knew that good teams don’t just hire for raw technical skill, they hire for essential non-technical attributes as well. What those traits are depend on the technical domain, the team culture, the current composition of the team, and so on.</p>
<p>Yes, you're right. A custom plan is extremely multi-dimensional, and getting things right is only moderately helpful, whereas getting things wrong can result in a giant loss of direction and waste of time.</p>
<p>Since I was almost halfway through my career, I was determined not to repeat past mistakes. I was going to be:</p>
<ul>
<li><p>Highly specific in my goals.</p>
</li>
<li><p>Highly intentional in my choices and actions.</p>
</li>
<li><p>Focused on what I wanted, paying no attention to the things I did not want.</p>
</li>
<li><p>Willing to change myself, my habits and negative beliefs, so that I could change the world around me.</p>
</li>
<li><p>Ready to focus on building a rewarding and fulfilling career rather than just “getting the next job”.</p>
</li>
<li><p>Ready to focus on delivering value for my future team rather than a “what’s in it for me” mindset.</p>
</li>
<li><p>Willing to play the long game – think in 5-10-25 year horizons rather than the next few weeks.</p>
</li>
</ul>
<p>I must confess, doing these things consistently was much harder than I anticipated. I slipped up a lot, especially on the first three. But since I had my custom plan written down, I let that be my guide and the sole source of truth for what I needed to do.</p>
<p>My plan required me to focus on fundamental programming skills, and then narrow it down to the segment that I felt matched my long-term goals and skills. For me, this was web development. This meant completely and ruthlessly avoiding all the “shiny new things” and doing things like Python or Java.</p>
<p>And tutorials and endless videos were not going to make me beat the competition. I calculated that the minimum set of skills I’d need to develop for my city would require 900-1100 hours of focused coding, practicing the right things in the right sequence.</p>
<p>Preparing the plan took several weeks. I kept refining and strengthening it and didn’t rush it artificially. I am very inspired by Abraham Lincoln (another lawyer who changed careers!) and he once said “Give me six hours to chop down a tree and I will spend the first four sharpening the axe”.</p>
<p>I was so tempted to dive right into my plan and get “busy” but I’d learned that being busy was so not the same as being effective. Once the plan felt as complete as it could be with the information I had at my disposal, I turned to executing on that plan, with total focus.</p>
<p>This meant a lot of sacrifice, and many, many days of self doubt, battling the temptation to switch, and learning to manage my energy. I developed some amazing habits during this time, but they were only obvious to me in hindsight. During those 6 months of work, I was constantly assailed by uncertainty, fear and occasional loss of hope.</p>
<p>Later on, I adapted this planning process to create a plan for Big Tech and especially for Google. That plan took another 500-600 hours of intentional study that was completely different from my plan to become a developer. More on that later.</p>
<h2 id="heading-early-results-and-thengoogle-swe">Early Results, and then…Google SWE</h2>
<p>Another lesson I’d learned from 4 years of trial, error, and failure was that I was very likely to change plans midway, switch resources, courses or focus.</p>
<p>This is a much more serious problem than we realize because every time we switch focus or plans we throw out the hard work we’ve done, go back to square 1 and…start…all…over…again.</p>
<p>Imagine if you were driving from A to B and kept taking U-turns and going back and restarting. You’d never get anywhere.</p>
<p>But I’d made myself a promise (it’s easier to keep a single promise than to keep a bunch of them!): I was going to complete my plan and then decide whether I would keep going. This time I wasn’t going to stop until I completed my plan.</p>
<p>I didn’t have to like doing it. I just had to like the possibilities that lay at the end of doing it.</p>
<p>My plan had a specific time when I would start interviewing even if I didn’t feel ready for interviews. But to get to that stage I had to get good at generating interview opportunities.</p>
<p>Again, my past experience in other careers helped me. I applied all my learnings over 18 years and secured 4 interviews within a few weeks, and got all 4 offers even though there were plenty of candidates with more experience, skill, and qualifications than I had.</p>
<p>It wasn’t because I was better at coding. I don’t see how that could be, given that I’d only been in the game for a few months.</p>
<p>I believe I got all 4 offers because <em>during the interview process</em> I demonstrated that I was a better candidate <em>for the hiring manager</em>. This approach was critical in how I presented myself.</p>
<p>Getting the offers is great, but I had an unexpected problem. Since my plan required me to be highly intentional about the kind of work I’d pursue, all 4 roles I’d applied for were the ones I really believed would be a fantastic start to my new career. How was I going to choose?</p>
<p>Yes it’s a great problem to have, but that doesn’t make the decision easy!</p>
<p>To resolve this problem intelligently, I learned to ask myself a very important question:</p>
<blockquote>
<p><em>Do I</em> <strong><em>know</em></strong> <em>this or do I simply</em> <strong><em>think</em></strong> <em>this?</em></p>
</blockquote>
<p>Very often we make decisions based on assumptions and beliefs that are completely untested, and we mistake our opinions or fantasies for reality. What we actually know is way less than what we believe without truly knowing.</p>
<p>Being intentional required me to focus on what I know rather than what I wished, or merely thought. I had to either find evidence to back my thoughts, or disregard thoughts for what I knew.</p>
<p>That framework developed my analytical powers and helped me choose the right first role in early 2019. I turned 39 around that time.</p>
<p>Till today I continue to use this <em>know vs think</em> framework in my personal decision making as well as in my engineering decision making. I find it to be an excellent framework for analyzing tradeoffs in complex decisions.</p>
<p>Looking back, I learned a TON about sticking to my plan, revisiting my goals, self-awareness and practicing being <em>intentional</em>.</p>
<p>A few months into my new role, I noticed that a lot of lawyers were starting to reach out and ask me how I did this. Curiously, many of them were people who insisted I was making a huge mistake and that wanting to learn to code at this stage was immature and foolhardy.</p>
<p>Now they wanted to “learn to code”. And that made me think.</p>
<p>What else have others said is “not possible”? <em>Do they</em> <strong><em>know</em></strong> <em>that or do they just</em> <strong><em>think</em></strong> <em>that</em>?</p>
<p>And my goals hadn’t changed. For me learning, growth, and team were still more important than brand or money. But I was almost 40 and I also wanted to explore life in a way that I’d never had the courage to do in the first half of my career.</p>
<p>So I decided to set myself a stretch goal: I was going to find out what being a software engineer at Big Tech was like. I’d worked in huge companies before and I knew that it isn’t for everyone – that’s the reason I went into startup and smaller companies in the first place.</p>
<p>But wouldn’t I learn and grow SO much by being surrounded by some of the “best” people in their field, from engineering to product and sales? Did I know this? Or did I just think it?</p>
<p>I did the research and found that on average people were happy in Big Tech. But I also found that most people were not as intentional as I was. So I confined my research to people who were very intentional about their careers. And they (almost universally) said they grew a lot from Big Tech, even if they decided to leave. Leaving Big Tech was also intentional, in pursuit of their end goals.</p>
<p>So I decided to try for big tech (including 3 of the FAMGA companies) and several others, in Silicon Valley, New York, and Seattle. I was still based in Australia, so this was a massive challenge.</p>
<p>I re-designed my plan. Several of the steps were the same but the coding curriculum would have to be massively overhauled. I also needed to find out how US big tech recruitment is done, and be worthy of a referral.</p>
<p>About 7 months later, I started generating interviews. I worked very hard to prove myself worthy of referrals for those 7 months, and people offered to give me referrals based on my efforts and proven commitment.</p>
<p>I got referred to Meta (it was called Facebook then) but I didn't get the interview as my skills were not the right match. This was a massive learning for me as I thought I’d been careful to only apply for roles where my skills matched – and I was wrong.</p>
<p>That was when I realized that sometimes the position description is written in ways that mean one thing for the hiring company but means very different things <em>outside that company</em>. This is because different organizations use the same words to mean different things. Both the hiring side and the candidate side can be unaware of this!</p>
<p>All these learnings added up. Within 3 months I got offers from 2 big tech companies, and missed out on a third at the final interview because I just didn’t know how to write a filesystem from scratch (I didn’t understand much about the Linux world at all!).</p>
<p>And then I got an offer from Google.</p>
<p>Again, I was faced with a very difficult decision. Google is a cultural force that is very hard to be objective about. But I really wanted to stay true to my goals, my plan, and my intentions.</p>
<p>Trying to separate what I knew from what I thought was EXTREMELY hard when it came to Google. But I was absolutely sure about one thing: the team I’d interviewed with were amazing people.</p>
<p>And this is where I believe luck matters. No matter what people say about skills, brains, smarts and all that stuff, luck and "magic" have a role in life.</p>
<p>My interviewers from Google were friendly, kind, cheerful and highly focused engineers. They were not looking to prove I sucked. They wanted to help me prove I was good. They answered my questions with enthusiasm, and I felt like collaborators from the first minute.</p>
<p>Is this a Google thing? Maybe. But later, when training to be a technical interviewer at Google, I witnessed a very wide variety of interviewer/hiring manager styles and beliefs. I saw candidates with great skill losing their nerve, struggle to communicate their process, and so on. And I came to appreciate the role of chance in all this.</p>
<p>So yes – I was lucky that I had the kind of interviewers I did, and that on interview day I happened to know how to work through the code.</p>
<p>This is also where my ultra-focused preparation on <em>type of work</em> and <em>relevant</em> skills paid off. There are a very large number of engineering roles at Big Tech that I would never have been suited to (like the one at Meta). Even with my prior experience in other careers, I had no idea how HUGE the engineering world is, and how many flavors and types there are, and how hard it is to tell them apart.</p>
<p>By forcing myself to be highly intentional and not randomly and blindly applying for big tech engineering roles, I improved my chances in small but important ways. I dug deep into each role and researched them carefully by speaking to friends in the industry (again – my age and experience was an asset because I had built relationships over 15+ years never expecting that they’d be so useful later on!).</p>
<p>For each offer I got, I had researched the role deeply, and prepared for the technical interviews well. On interview day the stars were aligned, and things worked out. Though I don’t think I “nailed” my interviews, I did well enough to communicate that I was a suitable candidate <em>for the team’s needs</em>.</p>
<p>Which leads me to the question: How did I prepare for the Big Tech interviews?</p>
<h2 id="heading-how-to-prepare-for-big-tech-interviews">How to Prepare for Big Tech Interviews</h2>
<p>Answer: In two phases that took me over 500 hours to execute.</p>
<h3 id="heading-phase-1-learn-the-realities-and-competitive-landscape">Phase 1: Learn the Realities and Competitive Landscape</h3>
<p>If I wanted to tackle Big Tech, from another country, with less than a year of industry experience, and 15+ years in an unrelated career, with no Computer Science degree, I needed to have a very clear view of the realities, especially the competitive landscape.</p>
<p>This means there was room for informed hope, but no room for dreamy-eyed, pie-in-the-sky magical and wishful thinking.</p>
<p>Hard truths (see my <a target="_blank" href="https://www.youtube.com/playlist?list=PLAPuklwJx5V3XZS19AlJQayZFpiZyDT9C">initial YouTube Videos on this here</a>). Hard realities. Hard work.</p>
<p>I had to fully internalize and appreciate the following:</p>
<ul>
<li><p>Coding is just the starting point. Not the ending point. Learning to code was the first step of many, one small piece of a much larger puzzle. In other words, it is necessary, <em>but not sufficient</em> to get a coding job (and especially at big tech).</p>
</li>
<li><p>My biggest enemy would be my own mind. It would either let the negativity of others get me down, or it would turn against me and undermine my own confidence. I had to build the habits that would help me have a resilient mindset. I focused on recovering from setbacks rather than avoiding them.</p>
</li>
<li><p>My competitors would likely not be career changers. Or if they were, they’d be from closely <a target="_blank" href="https://www.linkedin.com/posts/zubinpratap_software-engineering-computer-engineering-activity-6946411823759810560-VvA-?utm_source=linkedin_share&amp;utm_medium=member_desktop_web">related fields like computer engineering, mechanical engineering, or electronics engineering</a>. The vast majority would have technical qualifications, maybe even PhDs (this turned out to be true!), and several years of industry experience.</p>
</li>
<li><p>As an outlier and a “wildcard”, the hardest part would be getting the interviews. Learning algorithms and data structures would be easier. And “cracking the coding interview” (whatever that means…) would be easier too. Why? Code is deterministic – identical code generally produces identical results. But life is not deterministic, and getting interviews is highly subjective. In the job market, identical actions do not produce identical results.</p>
</li>
<li><p>I needed to shape myself into the <em>kind of person</em> seasoned engineers would want to work with</p>
</li>
<li><p>I assumed most of my competitors would have at least 3 -5 years of experience. I couldn't catch up with them, let alone <em>overtake</em> them. Instead, I needed to outperform them on non-technical skills and compare favorably (if not outperform them) on the technical stuff.</p>
</li>
<li><p>I had to communicate better than the others. If I didn’t know something, I’d need to say so and then communicate how I’d solve it if given the right time and opportunity. I also had to communicate to show interviewers that I understood <em>their business needs</em> and wasn’t just focusing on my selfish dreams.</p>
</li>
<li><p>Which means I had to really work on understanding what the hiring team valued, was looking for, wanted, and needed.</p>
</li>
<li><p>I could not control my competitors (their skill, their performance, how much they knew, and so on), or what my interviewer was thinking, wanting, what they valued, or whether they liked career changers or not. I could not control <em>most</em> things. I could only optimize my effort, my focus, my psychology, and how much learning I extract out of each experience, good or bad. I could only control my choices and actions. So focusing on anything outside that would be a waste of precious energy.</p>
</li>
<li><p>I had to accept the role of luck. Jordan, Tendulkar, Federer – they’ve all had bad days. I would too. Or maybe I'd do great, but on the day someone else would do better. Or someone else would just be a better fit for what the team needed. No harm, no foul. I’ve made those hard decisions on the interviewing side countless times myself, so I know how these things work.</p>
</li>
<li><p>If I was successful at more than 1 offer I would need to <em>pre</em>-think and <em>pre</em>-agree with myself about what signals and factors I would use to decide (I’d learned from my experience of choosing between my first 4 offers!).<br>  If you’re wondering how I knew how to do all this…I didn’t. Not all at once. What you’re reading is a summary in hindsight. But I had to work most of this out in “real time” based on “<a target="_blank" href="https://fs.blog/first-principles/">first principles thinking</a>”. And I worked with my mentor to tighten them up as I went along. It took a lot of time and I was so impatient to “start coding”. But …I knew what advice Abraham Lincoln would give me…</p>
</li>
</ul>
<h3 id="heading-phase-2-how-i-chose-my-learning-resources">Phase 2: How I Chose My Learning Resources</h3>
<p>I know everyone thinks there is a secret “magic bullet” out there. Some blog, video, resource, tutorial, podcast, PDF cheatsheet…_something…_that will unlock the entire “secret” and make us instantly learn things.</p>
<p>Nope.</p>
<p>I’ll bang on about this till the day I die – information is a commodity.</p>
<blockquote>
<p>Learning is hard, but it’s made much harder because there is <em>too much free information</em>.</p>
</blockquote>
<p>We all fall into the trap of thinking there is some missing piece of information. There isn’t.</p>
<p>Why? Because no matter where you live, what language you speak, what color your eyes, skin, or hair are, what gender you identify with – all resources are going to teach you things that “work”. They’re all “the same” at a very fundamental level.</p>
<p>They <em>have</em> to be, because that’s how computers work.</p>
<p>If you and I write an identical function in JavaScript or Python or Java, we are going to get identical results. That’s how computers work – they’re <a target="_blank" href="https://en.wikipedia.org/wiki/Deterministic_algorithm">deterministic</a> <a target="_blank" href="https://en.wikipedia.org/wiki/Deterministic_algorithm">algorithms</a>.</p>
<p>But life (and interviewing) is most decidedly <strong>not</strong> deterministic. Identical effort, grades, skill, intelligence will not produce identical results.</p>
<p>Again, I had to <em>teach myself to</em> <em>learn</em>. I had to teach myself to shift my attention away from resources/blogs/websites/courses and put my attention on building solid mental models, identifying relevant skills, drilling down on concepts rather than code implementations, applying what I already knew in new ways, reasoning, problem solving, and communicating my reasoning <em>while</em> I reasoned.</p>
<p>Now you’re going to be surprised by the resources I used for my Google and other Big Tech interviews.</p>
<p>Yes, I used <a target="_blank" href="http://leetcode.com">Leetcode</a>, <a target="_blank" href="http://algoepxert.io">Algoexpert</a>, <a target="_blank" href="http://interviewcake.com">InterviewCake</a> and <a target="_blank" href="https://www.youtube.com/c/JennyslecturesCSITNETJRF">Jenny’s CS Lectures</a> and perhaps a few others. But I didn’t complete a single one of them.</p>
<p>This wasn’t because I switched or lost focus. I was being intentional. I realized that they all teach the same thing, but with slightly different styles and content. So I used these resources to learn concepts and mixed and matched all these resources based on my analyses of interview <em>patterns</em>.</p>
<p>My reasoning was simple. Having been on the hiring side, I know that every year the quality of candidates (at good companies) improves. I personally think that focusing on the company is a huge mistake – we should focus on the team, people and <em>kind</em> of work.</p>
<p>But the world works a certain way, and because of that, everyone rushes to the big companies. This increases competition which makes it harder for hiring managers to assess candidates.</p>
<p>The only way for hiring managers to deal with this is to raise the bar, making it harder for candidates. The overall number of candidates keeps increasing, but the “pool” of candidates that get invited to the interview stays within a narrow range – usually 2 -10 people. Regardless of how many hundreds apply that’s about the number that will even get a chance to interview.</p>
<p>Therefore, the number of candidates that don’t hear back or meet with rejection increases, especially in bull markets.</p>
<p>If the competition is increasing and the resources on the internet are also increasing, but the shortlisted number stays more or less constant, then “learning more” cannot be the solution. Everyone is “learning more”, so relative to the competition there is no change.</p>
<p>I also realized that Big Tech would have lists of interview questions (this is “efficient” as interviewing is <em>very</em> time consuming, and so it makes sense to save time by having a question bank that interviewers could use). Naturally, they would not use these questions if they were “leaked” – that would defeat the interview process.</p>
<p>So, logically, hiring managers will not ask questions that are available on Leetcode or Algoexpert or other sites. This produces a kind of “arms race” – the more questions are made publicly available, the more questions in the question bank are changed. That results in more innovation and variance in questions and hiring strategies.</p>
<p>This left me only one choice. I had to learn to solve problems using mental models and by classifying them. Chances are I was never going to be asked to sort a Linked List or to implement Dijkstra’s shortest path algorithm. Instead, I would need to know how to apply these sorts of algorithms to “real world”, practical problems.</p>
<p>Often real world problems don’t look, sound, or smell like the practice questions we study. Practice questions and competitive coding questions tend to be “neatly” packaged up with clear constraints.</p>
<p>But as an interviewer, I wanted to know how the candidate thinks, reasons, analyses, interprets information, and collaborates. Solving the problem is a bonus. Often they have the right solution but run out of time – but ask great questions and clearly know how to tackle the problem. These candidates can still get the offer.</p>
<p>Later, as an engineer at Google, I could always tell if someone <em>knew</em> how to solve something even if they were unable to solve it in time. Equally, it’s immediately obvious when a candidate does not know how to solve something (and that's OK – we are all learning).</p>
<p>By adopting my approach of understanding problem types and solutions rather than specific code implementation, I could focus on learning to reason rather than learning to write specific algorithms.</p>
<p>This approach meant that I completed less than 40% of Algoexpert (and back then it had half the questions it has now). I also did maybe 50-60 questions from Leetcode and most of them weren’t the “hard” ones.</p>
<p>I figured that “hard” questions would probably show up in 45 minute interviews about 20% of the time which means 80% of the time they’d be easy or medium questions. So it made sense to optimize for the 80% given I was still relatively new to engineering and the hard problems would get in the way of understanding easy and medium ones.</p>
<p>I used these resources to recognise patterns rather than just “complete” and get a certification. That’s why I didn’t complete any of them. And no, I didn’t use “<a target="_blank" href="https://www.amazon.com/Cracking-Coding-Interview-Programming-Questions/dp/0984782850">Cracking the coding interview</a>” either.</p>
<p>Along the way I also started a systematic process of understanding system design questions. I documented system design preparation in a <a target="_blank" href="https://www.freecodecamp.org/news/systems-design-for-interviews/">long form blog on the essential concepts for system design interview questions</a>.</p>
<p>I also decided to focus on one language: JavaScript. It wasn’t the best for interviewing (seasoned engineers discourage it on Quora and elsewhere) but I didn’t see how it mattered. The purpose of the interview was not to test my choice of languages – it was to test my ability to think abstractly and solve complex computer science-y problems.</p>
<p>The language is just a tool (another core belief I hold). In fact, using an untyped language like JS would give me opportunities to talk about its limitations or strengths, which is an opportunity to demonstrate that I understand the tradeoffs in language choices. That way, I could showcase broader knowledge and insight without actually having to implement it all in code.</p>
<p>But a lot of the resources I learned from used Java or C++. These languages are the dominant languages at Google. So being forced to read these languages and understand the principles forced me to not focus too much on “spitting out the code” and more on reasoning through the code so that I could write it.</p>
<p>That was my entire plan. Practice, Pattern Recognition, Mental Models/First Principle Thinking, System Design, doing fewer things really well, and focusing on getting interviews rather than just learning more code.</p>
<h3 id="heading-how-to-stand-out-during-interviews">How to Stand Out During Interviews</h3>
<p>As I mentioned, we all have advantages and disadvantages. And we all think our disadvantages are special and huge and our advantages are common, unremarkable, and probably not of much use.</p>
<p>This is not true. Logically, if we all think our disadvantages are severe, then we should all succumb to them. Yet some people overcome them. Only to find that others had it even worse and overcame <em>those</em>.</p>
<p>It’s way better to focus on what we can do well. For me, I truly believed that I could add a lot of value to the team. I don’t care about being the smartest or the best. But I care about being an outstanding learner, and maintaining my <a target="_blank" href="https://www.youtube.com/watch?v=hiiEeMN7vbQ">growth mindset</a> at all costs.</p>
<p>And so I tried to use this to stand out as best I could. I learned to ask really good questions of recruiters, interviewers, and hiring managers.</p>
<p>But there was a deeper reason for this. Asking good questions was my way of interviewing the company. Like I said, I didn’t want to repeat the mistakes of the first half of my career. So asking really good questions was important for me to assess whether the company was a fit <em>for me</em> and not just the other way around.</p>
<p>Since I had decided that I was going to value the team and the learning over all else, I never asked about the compensation until the recruiter raised it. It was going to be lower than what I earned as a lawyer anyway!</p>
<p>Instead I focused very hard on learning about the team, its dynamics, its group beliefs and values, how the manager solved problems (especially people problems), what the team was interested in, what the company division was interested in, how its balance sheet was doing, what its strategy was, what its resource allocation and budgeting looked like, and so on.</p>
<p>All these things were things I'd learned in other industries, as an individual contributor, as a manager, executive, founder and so on.</p>
<p>And all of these things also showed that I was being highly intentional. I was genuinely interested in the team, and the company, its product and its future. This wasn’t just another job I was applying for. This was active and personal…not passive and opportunistic.</p>
<p>And I believe that helped me stand out. Maybe not for all the roles I interviewed for, but for many of the offers I got.</p>
<p>When I was on the hiring side, I’d always prefer candidates who were genuinely interested in the role, the people, the product and the company. Those that showed up just “to get a job” didn’t have the kind of energy and drive we wanted.</p>
<h3 id="heading-interview-planning-and-strategy">Interview Planning and Strategy</h3>
<p>The last aspect of my roadmap required me to deeply understand the different types of coding interview processes.</p>
<p>This included technical and non-technical interviews, the format of interviews, the way companies organize them, run them, plan them, staff them, evaluate them, and weigh them. But it also required me to understand my strengths and weaknesses.</p>
<p>When going for Big Tech in the US I was aiming for 2-3 interviews per month – a huge goal given that I was not even in the US and was in a timezone that was 17 hours ahead of the west coast.</p>
<p>I had to plan and structure interviews at weird hours so I could accommodate my day job as a developer and also my study time. Some interviews took 6 hours, some took 10 or more. Some were “pair programming for a day” type interviews.</p>
<p>All this took a ton of planning, and mental training. I had to be careful to get the right sleep, the right exercise, maintain my mindset and confidence, deliver on my day job, be there for my family, study and maintain focus on my goals.</p>
<p>For this, I had to be honest with myself at what I was good at. For example, I am not a morning person. But I can endure late nights. So I structured interviews, work, sleep, or even exercise accordingly.</p>
<p>There were some interviews that were scheduled at 2am or after, and I wouldn’t sleep before (as I really am not good at waking up on time!). So I’d do a full workout at 1am to get my energy and focus up, then interview, then sleep till 10 am, then go to work and manage my schedule accordingly.</p>
<p>I would also be careful to plan interviews so that I wasn’t doing two of them back to back unless they were very similar and time bound. For example, doing a take-home test and doing a timed test in the same week require different planning from doing a take-home and a live-coding interview – all while managing work and family.</p>
<p>To schedule the interviews appropriately I’d work closely with the recruiter and be very transparent with them. This had two advantages: I gained credibility and trust with the recruiter for being collaborative and communicative, and they also got to see that I had other opportunities going, which increased the value of my candidacy. Competition is a good thing.</p>
<h2 id="heading-concluding-thoughts">Concluding Thoughts</h2>
<p>I am sure many of you were expecting this article to give “insider” tips and a specific set of languages, and DSA questions to learn. I believe I’ve given you something much better. Rather than giving you fish, I am showing you how to fish.</p>
<p>Apart from the ethics of it, insider tips are of limited value, especially in Big Tech. In huge companies things can be vastly different from team to team and city to city. You need to understand the principles of recruitment and career development, rather than just the specific languages and algorithms. Assuming that all interviews are the same is a big mistake.</p>
<p>And as for our obsession with data structures and algorithms…managing your career is the ultimate algorithm. Your mind is the ultimate data structure. Learn how to work with both and you’ll always do well, despite the occasional failures. <a target="_blank" href="https://twitter.com/ZubinPratap/status/1534341043344252929">Powerful ideas aren’t grandiose – they’re elegantly minimal</a>.</p>
<p>If you have read this article you will have noticed some of the things I linked to include multiple ways to reach me. You can also get invited to my <a target="_blank" href="https://futurecoderstraining.com">webinars, mini-courses and newsletters</a> if you want to go beyond just “learning to code” and learn how to build a career that is <em>right for you</em>.</p>
<p>Perhaps the most important message I can leave you with is that it is a mistake to obsess about big tech. Yes, they’re great to be part of, but if we believe they’re the only thing that is right for us we will miss out on all the other amazing opportunities.</p>
<p>Big Tech has glamor because of cultural trends these days. Sure, it’s nice to work for a great organization, but plenty of great organizations are not well known. Plus what is “great” for one person is pain for another.</p>
<p>Your number one priority is to be happy, fulfilled, and live the life that you want. This is not derived from a company. This comes from the people you spend time with (especially colleagues) and the kind of work you do. Big Tech companies have their share of bad managers, teammates, and work, just like any other company.</p>
<p>If you build skill, stack a great plan on top of the right mindset, and train yourself to set the right goals, you can achieve much more than you dreamed of – with or without Big Tech.</p>
<h3 id="heading-post-script">Post Script</h3>
<p>If you would like to learn more about my journey from lawyer to software engineer, check out <a target="_blank" href="http://podcast.freecodecamp.org/53-zubin-pratap-from-lawyer-to-developer">episode 53</a> of the <a target="_blank" href="http://podcast.freecodecamp.org/">freeCodeCamp podcast</a> and also <a target="_blank" href="https://lessonsfromaquitter.com/episode207/">Episode 207</a> of "Lessons from a Quitter". These provide the blueprint for my career change.</p>
<p>If you are interested in teaching yourself to code, changing careers and becoming a professional coder, or <a target="_blank" href="https://www.freecodecamp.org/news/non-technical-and-looking-for-a-technical-co-founder-2c212c01d6da/">becoming your own technical co-founder</a>, please reach out <a target="_blank" href="http://linktree.com/zubinpratap">here</a>. You can also check out my free webinar on <a target="_blank" href="http://futurecoderstraining.com/">Career Change to Code</a> if that is what you're dreaming of.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Prepare for Technical Interviews – Problem-Solving Tips + Mindset Tricks to Get You Ready ]]>
                </title>
                <description>
                    <![CDATA[ Hi everyone! In this article we're going to talk a bit about technical interviews. I'll share a few tips that, based on my experience, might help you go through these interviews successfully. I originally wrote this article more than a year ago, befo... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/problem-solving-and-technical-interview-prep/</link>
                <guid isPermaLink="false">66d45f1ad1ffc3d3eb89ddf7</guid>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interviewing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mindset ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Problem Solving ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ German Cocca ]]>
                </dc:creator>
                <pubDate>Mon, 06 Jun 2022 22:50:19 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/06/pexels-christina-morillo-1181345.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Hi everyone! In this article we're going to talk a bit about technical interviews. I'll share a few tips that, based on my experience, might help you go through these interviews successfully.</p>
<p>I originally wrote this article more than a year ago, before getting my first job offer as a developer.</p>
<p>I'm sharing this with you now because I recently went through another interview process. And I found that the same concepts and thoughts that helped me get my first job offer allowed me to pass all the interviews successfully again. 🙂</p>
<h2 id="heading-my-background">My Background</h2>
<p>I took up coding more or less a year ago. I started learning out of pure curiosity, and as I learned more about it and was able to build personal projects, I just fell in love with it.</p>
<p>I got so obsessed and passionate about it that I dedicated all the free time I had to coding, reading about code, watching videos about code, and just learning as much as I possible could, because for me it was fun and interesting!</p>
<p>Time passed and at a point I started imagining myself working as a developer. First it was like a blurry thought, and then I started thinking about it seriously and learning about what I needed to do to get to that point.</p>
<p>My learning journey and the approach I took towards becoming a dev will probably be the subject of another article, but my point is that I made it! I recently got an offer for my first job as a full time developer and I couldn’t be happier about it.</p>
<p>And there were many things and learning experiences I had to go through to get to this point, but I’d say the toughest one – and the one I was less prepared for – was technical interviews.</p>
<h3 id="heading-what-are-technical-interviews-like">What are Technical Interviews Like?</h3>
<p>I come from a social sciences background, and most of the time, within that field, there’s nothing too “technical” to talk about during interviews. Employers normally hire you based on your experience and behavior during interviews.</p>
<p>But in the coding field it’s really different. Experience is valuable, of course, but employers also value projects you can show to them, theoretical knowledge about different programming topics, and, most of all, the problem solving skills you can show off during technical interviews.</p>
<p>In almost all selection processes I went through, there was a technical interview in which an interviewer tossed me a problem and I had to solve it live with them looking at me the whole time.</p>
<p>This is a standard practice for coding jobs, but I wasn’t prepared at all. I failed miserably more than once, and these experiences were some of the most embarrassing and frustrating moments in my professional life so far.</p>
<p>At times I felt stupid for even thinking I’d be capable of switching careers at almost 30. I thought I just wasn’t smart enough. But luckily I kept going, researched about technical interviews, learned, practiced, and kept failing until I didn’t fail anymore.</p>
<p>Technical interviews are tough and can be really stressful if you’re not prepared correctly. Also, even though I successfully passed a selection process, I know I still have a lot to learn about this and that I’ll need to perfect this skill to further grow my career in the future. So here are my main tips for nailing your technical interviews.</p>
<h2 id="heading-1-prepare-for-the-interview"><strong>1. Prepare for the Interview</strong></h2>
<p>This is important for all kind of interviews, but for technical interviews I think it’s crucial. Your chances of passing these evaluations are way lower if you don’t prepare correctly for them.</p>
<p>Here are some ideas that allowed me to better prepare for these interviews.</p>
<h3 id="heading-do-your-research">Do Your Research</h3>
<p>Find out about technical interviews in general, how are they normally organized, what interviewers ask and what do they intend to measure, what kind of problems do companies toss at you, and what are the best approaches towards interviews.</p>
<p>The internet is an infinite resource of knowledge, so don’t waste it! Google about everything you can and take advantage of the experience of the thousands of people who have gone through similar situations and share their experiences.</p>
<h3 id="heading-practice-solving-problems">Practice Solving Problems</h3>
<p>Problem solving is a skill just like any other. There is specific knowledge you’ll need to get good at it, but most of it is practice and getting your brain to be comfortable in that situation.</p>
<p>There are tons of websites that contain the types of problems you’ll see during interviews. <a target="_blank" href="https://www.freecodecamp.org/learn/coding-interview-prep/">freeCodeCamp has an amazing course designed for this.</a> Some other cool resources are <a target="_blank" href="https://www.hackerrank.com/">hackerrank.com</a>, <a target="_blank" href="https://leetcode.com/">leetcode.com</a>, <a target="_blank" href="https://www.codewars.com/">codewars.com</a>, <a target="_blank" href="https://exercism.io/">exercism.io</a>, <a target="_blank" href="https://app.codesignal.com/">app.codesignal.com</a>, and <a target="_blank" href="https://www.algoexpert.io/">algoexpert.io</a>.</p>
<p>Solve as many problems as you can from any of these sites and you’ll start getting good at them.</p>
<p>And when you practice, at first it’s okay to just worry about solving the problem. But once you get comfortable enough, a great idea is to try to make your practice as similar as possible to an actual interview. And by this I mean setting a timer, explaining your solution out loud, analyzing your final algorithm and refactoring…just basically following all the steps you’d normally follow in an actual interview.</p>
<p>If your practice is similar to the actual situation, once you get to that situation you’ll feel more confident because in some way you’ve already been there.</p>
<h3 id="heading-build-a-theoretical-foundation">Build a Theoretical Foundation</h3>
<p>Besides actually practicing, learning theoretical concepts about algorithms and data structures is a great idea to get better at solving these problems.</p>
<p>Think about it as adding tools to your toolbox. The more tools and concepts you have in your mind, the more problems will sound familiar or ring a bell in your brain, and from that you'll be more able to arrive at a solution.</p>
<p>There are many resources on the internet, some free and some paid. A course about data structures and algorithms is pretty much a must for any programmer, so I encourage you to find a good one. Here are a couple you can start with:</p>
<ul>
<li><p><a target="_blank" href="https://www.freecodecamp.org/news/learn-all-about-data-structures-used-in-computer-science/">Data Structures Explained</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/news/learn-data-structures-from-a-google-engineer/">Learn Data Structures from a Google Engineer</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/news/learn-algorithms-and-data-structures-in-python/">Learn Algorithms and Data Structures in Python</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/news/algorithms-and-data-structures-free-treehouse-course/">Learn about Algorithms and Data Structures</a></p>
</li>
</ul>
<p>Of course also theoretical knowledge about your programming language of choice and any other tools in your stack (frameworks, libraries, databases, and so on) is also very important.</p>
<h3 id="heading-imitate-others">Imitate Others</h3>
<p>It’s ok to run into problems you don’t know how to solve or to come up with solutions that are not the best suited ones.</p>
<p>In these type of situations, or always actually, it’s a good idea to take a look at how other people solved that same problem and learn from them. What approach did they take? What ideas did they have? Did they get stuck? How did they move towards the solution?</p>
<p>Analyze their solution and their behavior, identify what works for them, think if that could work for you and if the answer is yes, copy them! It’s crucial that you deeply understand why their solution works and how their logic works. You want to internalize the logical approach, not the code, as that’s just an after effect.</p>
<p>Looking at problem solutions and videos of mock interviews is a good idea to get this kind of data.</p>
<h3 id="heading-understand-what-kind-of-interview-youll-have">Understand What Kind of Interview You'll Have</h3>
<p>I mentioned the most classic type of technical interview is the one based on algorithms and data structures, in which the interviewer will give you a problem to solve through an algorithm.</p>
<p>But I found that there're also interviews that are mostly theoretical, in the sense that the interviewer will ask questions to measure your knowledge about a given programming language, framework, library, design and architecture patterns, and so on.</p>
<p>Another kind of interview is where the interviewer shows you an actual project or asks you to build one. During the interview you discuss the decisions you made to build it or implement new features/modifications on it.</p>
<p>Each kind of interview is different and might require different preparation, so it's always a good idea to ask the company what will the interview be based on, and prepare accordingly.</p>
<h2 id="heading-2-breathe-and-think-things-through"><strong>2. Breathe and Think Things Through</strong></h2>
<p>Once you've seen and gone through a ton of examples and start feeling somewhat confident around coding problems, it’s time to get to the deeper stuff.</p>
<p>Here are some tips that helped me go through the interviews successfully.</p>
<h3 id="heading-dont-code">Don’t code</h3>
<p>This sounds crazy right? The best approach to solving most coding problems is actually not coding, or at least <strong>not right away</strong>.</p>
<p>No matter how anxious or secure you are about the idea you have in mind, I find it better to always take a step back and make sure you understand things deeply before going to the details and breaking out the code.</p>
<p>So how do you do that?</p>
<h3 id="heading-understand-the-problem">Understand the Problem</h3>
<p>The first step to solving a problem is actually understanding it. And to understand it, the best idea is to “make it yours”, and internalize it.</p>
<p>A good idea is to read the exercise twice, repeat it again in your own words, and go through multiple examples (simple ones, complex ones, examples with null or invalid inputs…).</p>
<p>No matter how silly, complex or simple the problem may seem, this helps you make sure you understand it properly and gives your brain data and time to come up with solution ideas.</p>
<h3 id="heading-make-sure-you-understood-it">Make Sure You Understood It</h3>
<p>Repetitive? Yeah, but effective. Check and make sure you understood what you need to do and how your function will work.</p>
<p>Ask yourself, what are the inputs going to be? What will be the output? Check for edge cases. Will you always receive the same input or could you expect different formats? Do you have to be prepared for strange cases or does the exercise restrict the kind of situation you’ll encounter?</p>
<p>It’s better to clear out all this things before even starting to think about a solution.</p>
<h3 id="heading-explore-your-toolbox">Explore Your Toolbox</h3>
<p>I said that learning theoretical concepts and practicing is like adding tools to your problem solving toolbox. When you see a new problem, it’s a good idea to explore that toolbox and see if any of the concepts or solutions you’ve used in the past could work here.</p>
<p>Could it help to use some sort of counter? What about implementing some sort of data structure to help you out? Could you use pointers or a sliding window? Would it be a good idea to take a divide and conquer approach? What about recursion? Could sorting the input help for anything?</p>
<p>You don’t necessarily have to know the exact path to take, but comparing the problem to previous patterns you’ve seen can help spark ideas in your mind.</p>
<p>Of course the more you practice solving problems and learning about possible solutions, the more patterns you’ll have to remember and compare.</p>
<h3 id="heading-break-down-the-problem">Break Down the Problem</h3>
<p>Once you’ve analyzed the problem deeply, hopefully you’ll have at least an idea of how to tackle it, or where to start.</p>
<p>A great idea here is to try to think about the different steps you need to take to get to your solution and write down those steps to analyze them, check if your logic is correct, and later use them as little memory helpers and “instructions” for you to translate into code.</p>
<p>Simplifying your solution through steps and specially writing them down will often help you identify flaws in your logic or cases you didn’t think about before.</p>
<p>This is great because you’re at a stage when it’s really easy to modify your approach or lean towards a different idea. You didn’t waste time coding or getting yourself into a maze of logic that doesn’t actually work.</p>
<h3 id="heading-simplify-the-problem">Simplify the Problem</h3>
<p>Specially when facing complex and difficult problems, a good idea is to first ignore the main difficulty of the problem and try to solve a similar, simpler version of it.</p>
<p>When you nail that solution, bring the main difficulty back and see if you can translate your solution to it.</p>
<h3 id="heading-visualize-the-problem">Visualize the Problem</h3>
<p>Complex problems are sometimes difficult to get your head around. Having a whiteboard, either a physical or a digital one, is always a great idea.</p>
<p>Visually stimulating your brain by drawing up the problem or an idea can be a good approach to buy yourself some time and see if that perspective shows you some data you didn’t notice.</p>
<h3 id="heading-start-to-write-your-code">Start to Write Your Code</h3>
<p>So once you have a clear idea of the steps you’ll need to cover to get to the solution, it’s time for translating that into code. This should be the simple part if you’re comfortable enough with the language.</p>
<p>A thought to keep in mind here is that if you can’t remember something very specific, don’t let that hold you down – pseudo code it and carry on with the rest of the solution.</p>
<p>Talk to your interviewer and see if they can help you with that part, or ask if they'll let you Google it. In most cases this will be ok and the important thing will be to show that you nailed the correct logic to solve the problem.</p>
<h3 id="heading-test-your-code">Test Your Code</h3>
<p>Test your solution at every step and at the end. There’s nothing more annoying than writing a ton of code and later seeing it fail without knowing the exact cause.</p>
<p>Test your code and your logic at every step of the solution, as this will allow you to catch bugs earlier and will save you from wasting time and effort.</p>
<p>Of course testing at the end is important to check if your solution actually works! So throw your function different inputs and edge cases to see if it behaves as expected.</p>
<h3 id="heading-analyze-the-solution">Analyze the Solution</h3>
<p>Once you've gotten to the solution, you’re not done yet. It’s a great idea to show your interviewer you can analyze what you did too.</p>
<p>Ask yourself and tell them, what’s the big O complexity of your solution? Can you think of a way to improve the performance or the memory usage of your algorithm? Is there a way to make your function easier to read and understand?</p>
<p>Even if you can’t think about how to code it exactly, it’s great to show them that you’re the kind of developer who is always going to look for improvements and not settle for something that just works.</p>
<h3 id="heading-improve-your-solution">Improve Your Solution</h3>
<p>Of course, if you can find ways to optimize your solution and know how to code it, do it!</p>
<p>And about this, in a coding interview situation you’ll rarely come up with the perfect solution for a problem. You’re under pressure and on the clock, so it’s perfectly ok to come up with a so-so solution and then refactor it until it reaches an acceptable level.</p>
<p>It’s often better to show you can solve the problem even if not in the perfect way than spend all your time just thinking about the perfect solution.</p>
<h3 id="heading-talk-to-your-interviewer">Talk to Your Interviewer</h3>
<p>Talk with your interviewer during the whole process. What your interviewer is trying to measure is your problem solving ability and your level of comfort with your programming language of choice.</p>
<p>That is a hard thing to measure if you don’t open your mouth and just code away.</p>
<p>It’s crucial that you talk to your interviewer and let them know what you’re thinking, what is your thought process, what ideas are you having, how are you understanding the problem, what logic are you going to follow with your solution and why are you making decisions.</p>
<p>Talk to them, ask questions, explain yourself, and if you get stuck or don’t know how to go on, explain to them exactly the thing that is giving you trouble. In most cases you’ll get some help and more importantly you’ll show them you’re actually trying to work towards a solution.</p>
<h3 id="heading-listen-to-your-interviewer">Listen to Your Interviewer</h3>
<p>When you’re being given the problem to solve – and specially if you get tips or feedback from your interviewers – pay attention! No matter if you think you already have the best idea or if there’s something that’s driving you crazy and need to solve right now, just drop it and listen to what you’re being told.</p>
<p>If you don’t listen to feedback, you’re giving a very negative signal to your possible future employers. Think about it: would you like to work with someone that doesn’t listen to feedback? Besides, feedback will certainly help you solve your problem, so listen!</p>
<h2 id="heading-3-control-your-emotions"><strong>3. Control Your Emotions</strong></h2>
<p>This for me was the toughest part of the interviewing process, and it's something I didn’t really find a lot of information about when researching technical interviews.</p>
<p>Dealing with the anxiety and frustration these situations can provoke is hard, but also a crucial step to improve your performance.</p>
<p>So here are some things that have helped me in this regard.</p>
<h3 id="heading-prepare-your-body-and-mind">Prepare Your Body and Mind</h3>
<p>Interviews are stressful situations in which you have to deal with expectations and perform to reach those expectations while being judged by other people.</p>
<p>I’ve always felt uncomfortable in these type of situations so I’m quite familiar with the type of anxiety you might feel.</p>
<p>Something that helps me is try to think about it like the moment of a game for a sports player or when actors get out on stage. You normally see these people trying to warm up and focus before they start to perform, right? There’s a reason for that – and it’s that this preparation actually enhances performance and gets you ready to give your best.</p>
<p>It may sound stupid at first, but stretching, warming up your voice, meditating, imagining the moment in your mind and picturing yourself being successful in the moment are all things that will push you towards doing nicely in this important moment.</p>
<h3 id="heading-be-confident">Be Confident</h3>
<p>Easier said than done, right? Absolutely. Confidence for most people isn’t something you can just turn off and on, but something you build along the way and comes with lots of practice, studying, and preparation behind it.</p>
<p>You'll build confidence with the work you do prior to the interview, but once you’re in the moment it’s important to remember that you want to show the interviewers you have confidence in yourself as a coder and that you trust yourself to solve any problem you face.</p>
<p>This doesn’t mean you have to know absolutely everything and be able to solve any complex problem absolutely by yourself. Rather, it means that you won’t panic when you face something you don’t know how to solve at first, and that you have the ability to slowly analyze the problem, break it down, and work towards a solution.</p>
<h3 id="heading-slow-down">Slow Down</h3>
<p>Stress, anxiety, and the wish to show that you can solve the problem can make you rush more than you need to. And rushing can lead to missing key information, flaws in your logic, bugs in your code, and errors in general.</p>
<p>So take your time, actually, take more time than you actually need. Analyze the heck out of the problem, talk slowly, code slowly, think slowly, and remember to breath. Things are easier to deal with when you take your time and <em>slow-mo</em> the process.</p>
<h3 id="heading-dont-take-it-personally-or-do">Don’t Take it Personally – or Do...</h3>
<p>You’ll mess up at some point, that’s a certainty. Especially in your first interviews, you’ll probably fail and feel miserable about it. It’s just the way it is, and it's a step that is needed for you to understand where you need to improve.</p>
<p>A key issue here is how you deal with that frustration. I could tell you to think about it as a process, to not get mad when you fail, to be patient… But if you’re an anxious and self demanding person as I am, you’ll be very frustrated when you fail, and there’s nothing you can do to avoid it.</p>
<p>But how do you deal with that? Do you get depressed and quit coding forever? Do you get scared of interviews and never apply for a job ever again?</p>
<p>Personally, I get very mad at myself when I fail at something or find out I don’t know something I "was supposed" to know. I get mad at myself for not preparing correctly or for missing things, and even though that anger feels bad at first, later on is something that pushes me forward.</p>
<p>I feel so bad about it that I make absolutely sure I won't fail at that again, and I practice as hard as I can to avoid being in that situation again.</p>
<p>Different approaches work for different people, but the thing is to handle your emotions in a way that pushes you forward and not backwards.</p>
<h3 id="heading-learn-from-your-mistakes">Learn from Your Mistakes</h3>
<p>As it’s a certainty you’ll mess up, the smart thing to do is to learn from the errors you made and try to not make them again.</p>
<p>Always try to take note of the problems you were presented and your solutions, analyze your mistakes, analyze other possible approaches you could have taken, what optimizations you didn’t see, and what key concepts you didn’t remember at that moment.</p>
<p>Also always ask your interviewers for feedback about what you could have done better. This information is gold if you get the best of it.</p>
<h3 id="heading-have-fun">Have Fun</h3>
<p>If you love coding, you probably have lots of fun doing it. Never forget that, no matter the context.</p>
<p>In interviews, try to approach each problem with curiosity rather than fear of failing. Try to show your interviewers you’re enthusiastic about problems, because you’re probably going to work with similar stuff on a daily basis.</p>
<p>Plus if you’re having fun and thinking in a positive way, you’ll be more relaxed and your mind will be clearer, which of course helps your problem solving skills.</p>
<h3 id="heading-keep-going">Keep Going</h3>
<p>If you pass or if you fail, at the end it doesn’t matter, in the sense that your approach and behavior should stay the same.</p>
<p>Just as code can always be improved, so can you as a programmer. You should always keep learning, keep getting better, keep practicing, keep facing stuff you didn’t know anything about and eventually overcoming it.</p>
<p>So don’t get too high if you pass or too low if you miss – just keep coding and keep learning.</p>
<h1 id="heading-roundup"><strong>Roundup</strong></h1>
<p>As always, I hope you enjoyed the article and learned something new. If you want, you can also follow me on <a target="_blank" href="https://www.linkedin.com/in/germancocca/">LinkedIn</a> or <a target="_blank" href="https://twitter.com/CoccaGerman">Twitter</a>.</p>
<p>See you later!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/06/see-you-soon-see-you.gif" alt="Image" width="600" height="400" loading="lazy"></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Coding Interview Prep – Free Resources to Help You Ace Your Interviews ]]>
                </title>
                <description>
                    <![CDATA[ By Evan SooHoo In the words of RealToughCandy, everyone wants a "one-stop shop" when it comes to learning. She uses this term to describe Educative.io, but Educative.io costs $60 a month unless you choose to commit to its annual plan. So it's not a f... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/coding-interview-preparation/</link>
                <guid isPermaLink="false">66d45edb73634435aafcef9e</guid>
                
                    <category>
                        <![CDATA[ algorithms ]]>
                    </category>
                
                    <category>
                        <![CDATA[ coding ]]>
                    </category>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ leetcode ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Software Engineering ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 16 Nov 2021 23:50:43 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/11/thisisengineering-raeng-LxVzgYjkHp4-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Evan SooHoo</p>
<p>In the words of <a target="_blank" href="https://www.youtube.com/channel/UC54NcJvLCvM2CNaBjd5j6HA">RealToughCandy</a>, everyone wants a "one-stop shop" when it comes to learning.</p>
<p>She uses this term to describe <a target="_blank" href="https://www.educative.io/learn">Educative.io</a>, but Educative.io costs $60 a month unless you choose to commit to its annual plan. So it's not a free resource, which means it's not available to everyone.</p>
<p>If money were not a factor, you might buy a copy of <em>Cracking the Coding Interview</em>, get a LeetCode Premium subscription, and sign up for access to <a target="_blank" href="https://www.educative.io/courses/grokking-the-coding-interview">Grokking the Coding Interview</a> before scheduling some mock interviews. </p>
<p>Now, websites like LeetCode are interesting because they provide an excellent resource for free. A large percentage of LeetCode questions are free, the discussions section provides free solutions where the best code/explanations are voted to the top, and the platform itself can run hundreds of test cases in seconds.</p>
<p>Many people argue that <a target="_blank" href="https://www.youtube.com/watch?v=hhvvTD8SapI">LeetCode premium is not worth it</a>, though writers like Yangshun Tay beg to differ. What interests me about LeetCode is not their premium option, but that they make so much of their service available without it. </p>
<p>All that being said, there are a number of quality free resources you can use to prepare for your coding interviews. Let's go through my favorites now.</p>
<h2 id="heading-best-free-resources-for-coding-interview-prep">Best Free Resources for Coding Interview Prep</h2>
<p>Without further ado, here are the best free resources I have found for coding interview preparation:</p>
<h3 id="heading-freecodecamp-articles">freeCodeCamp articles</h3>
<p><a target="_blank" href="https://www.freecodecamp.org/news/coding-interviews-for-dummies-5e048933b82b/">The 30-minute guide to rocking your next coding interview</a> is a free article available on FreeCodeCamp. Half the value here is in curated lists of LeetCode questions to match every major topic</p>
<p>Here's <a target="_blank" href="https://www.freecodecamp.org/news/javascript-interview-prep-cheatsheet/">another great (and extensive) guide</a> that focuses on JavaScript interviews and goes through all the JS basics you'll need to know. It includes tons of code samples, and moves through the material in an approachable way.</p>
<h3 id="heading-cracking-the-coding-interview">Cracking the Coding Interview</h3>
<p><em>Cracking the Coding Interview</em> is still one of the best resources out there for interview prep, even in 2021. I have heard some people say that it is no longer sufficient, but I have had two coding interviews that were taken out of the book almost verbatim. </p>
<p>Unfortunately, this is not a free resource...but <a target="_blank" href="https://leetcode.com/discuss/general-discussion/1152824/cracking-the-coding-interview-6th-edition-in-leetcode">here is a LeetCode forum that maps every CTCI question to a LeetCode one</a>. </p>
<p>The reason this is acceptable is that they are not perfect mappings. For example, <a target="_blank" href="https://leetcode.com/problems/string-compression/">the LeetCode String Compression problem</a> is not exactly the same as its CTCI equivalent because it has an added constraint. It is actually <em>harder</em> than the CTCI version</p>
<p>If you do choose to purchase <em>Cracking the Coding Interview</em>, the solutions are all freely available on <a target="_blank" href="https://github.com/careercup/CtCI-6th-Edition">GitHub</a>. They are in multiple programming languages, in case you are not a Java developer. </p>
<p>McDowell herself built the repository and committed the Java portion to it, so it is very unlikely the repository will removed due to copyright infringement.</p>
<h3 id="heading-basecs">BaseCS</h3>
<p><a target="_blank" href="https://medium.com/basecs">BaseCS</a> is a great collection of articles that explain computer science fundamentals, from hash tables to sorting algorithms, with custom illustrations, well-written analogies, and light-hearted explanations. </p>
<p>Best of all, every single article is free from the Medium paywall. Had they not been, Joshi probably could have pocketed hundreds, if not thousands of dollars from all her readers.</p>
<h3 id="heading-educativeio">Educative.io</h3>
<p>The Educative.io course on 14 coding patterns is not free, but <a target="_blank" href="https://hackernoon.com/14-patterns-to-ace-any-coding-interview-question-c5bb3357f6ed">a summary</a> is available on HackerNoon and written by an Educative.io cofounder...presumably as either a gesture of goodwill, or a "free sample".</p>
<h3 id="heading-leetcode-questions-sorted-by-programming-pattern">LeetCode questions sorted by programming pattern</h3>
<p>Here is a public <a target="_blank" href="https://leetcode.com/discuss/career/448285/list-of-questions-sorted-by-common-patterns/453408">LeetCode post</a> that maps all 14 coding patterns to respective lists of LeetCode problems.</p>
<h3 id="heading-interviewnoodle-still-in-development">InterviewNoodle – still in development</h3>
<p>Arslan Ahmad is building a consolidated collection of interview preparation articles <a target="_blank" href="https://medium.com/interviewnoodle">on Medium</a> called InterviewNoodle. Just weeks ago, I would have written that this resource is very incomplete, but he has added so much content that I actually think he may now want to divide it into sections.  </p>
<p>This, like Educative.io, is meant to be a “one-stop shop.” That Arslan Ahmad is the founder of <a target="_blank" href="https://designgurus.org/course/grokking-the-system-design-interview?utm_source=google&amp;utm_medium=googAd&amp;utm_campaign=keyword_ad&amp;utm_id=goog1&amp;gclid=CjwKCAiAvriMBhAuEiwA8Cs5lQID0O_VM4qHE-espa4XePw22toAUEPvR2DKp1-s3Vnne9T19JBp1hoCp0sQAvD_BwE">Design Gurus</a> increased my respect for him exponentially, since this means he is attempting to build a free version of an Educative course that makes him money.  </p>
<p>Currently the Medium pages on this publication are not paywall blocked. This could be a coincidence, but for now it's a great resource.</p>
<p>The rest of this article will cover additional resources, though the ones above are my favorites.</p>
<h2 id="heading-additional-coding-interview-prep-resources">Additional Coding Interview Prep Resources</h2>
<h3 id="heading-an-interview-primer">An Interview Primer</h3>
<p>If you don't know what to expect in a coding interview, the "30-minute guide" from freeCodeCamp linked above is a great "primer". Still, it is rather lengthy – even though it takes 30 minutes to just read through it, it would take much longer to actually review and go through its "General tips" section.</p>
<p>This might be just what you're looking for if you want to be really thorough. But what other options do you have?</p>
<p>"Confessions from a Big Tech Hiring Manager" is my single favorite video. It's by "Pragmatic Engineer," and is all about the interview process. </p>
<p>This video has useful and practical advice, but it also conveys the perfect attitude. He argues that you should think of every failed interview as a learning opportunity.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/vFOw_m5zNCs" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h3 id="heading-other-interview-prep-articles">Other Interview Prep articles</h3>
<p>"<a target="_blank" href="https://betterprogramming.pub/if-software-engineering-is-in-demand-why-is-it-so-hard-to-get-a-software-engineering-job-c043a964e463">If software engineering is in demand, why is it so hard to get a software engineering job?</a>" This is a tongue-in-cheek overview of the coding interview process. </p>
<p>If you read it, you should probably ignore the "string compression" story, which does not add much to the article.</p>
<p><a target="_blank" href="https://medium.com/interviewnoodle/the-other-side-of-the-software-engineer-interview-a8772edac0fc">The other side of the software engineer interview</a> is a kind of sequel to the article above, summarizing and responding to Pragmatic Engineer's thoughts.</p>
<p><a target="_blank" href="https://medium.com/illumination/the-responses-i-got-from-a-software-developer-candidate-that-made-me-hire-him-98ff8bf01298">The Responses I Got From A Software Developer Candidate That Made Me Hire Him</a> is an article that provides more insight on the interviewer's perspective, but unlike the two above it is behind Medium's paywall.</p>
<h2 id="heading-whats-the-interview-process-like-in-a-nutshell">What's the Interview Process Like, In a Nutshell?</h2>
<p>If I were asked to summarize all the resources above to you, here's what I would share:</p>
<ul>
<li>I would say that you typically get between 30 minutes to an hour to solve a coding question. </li>
<li>You typically get a choice of programming language like C++, Python, Java, or JavaScript, but not always...in some instances you do not have a choice.</li>
<li>Outside of the coding portion, they are free to ask you pretty much anything, from language-specific questions to favorite projects, but any interview with a coding portion tends to be dominated by it.</li>
</ul>
<p>And here's some general advice to consider: you are going to be dealing with people who may be pretty tired of interviews. Smile if you can. Try to show enthusiasm. Have a conversation, and try to talk to the interviewer the way you might communicate if the two of you were pair programming, but they were more senior.</p>
<h2 id="heading-how-to-start-your-interview-prep">How to Start Your Interview Prep</h2>
<p>I think that for most people starting out in this interview prep process, LeetCode is pretty hard. Here are two possible starting problems, though the best point of entry is admittedly <em>Cracking the Coding Interview.</em></p>
<ul>
<li><a target="_blank" href="https://leetcode.com/problems/fizz-buzz/">FizzBuzz on LeetCode</a>. I recommend it because it should not require any additional interview preparation, and will help you familiarize yourself with the LeetCode platform.</li>
<li><a target="_blank" href="https://medium.com/interviewnoodle/fizzbuzz-68fcdec8d2b2">Here's an article about FizzBuzz</a> on InterviewNoodle so you can learn more what that's about.</li>
<li><a target="_blank" href="https://leetcode.com/problems/jewels-and-stones/">Jewels and Stones on LeetCode</a>. If you are not able to solve this on your first try, then you will have to learn a technique that is useful in many coding interview problems.</li>
</ul>
<h3 id="heading-learn-about-hashmaps">Learn about hashmaps</h3>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/kVgy1GSDHG8" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p>There are many more data structures than just hashmaps, but I see these come up in coding interviews so often that I think they deserve their own section.</p>
<ul>
<li><a target="_blank" href="https://leetcode.com/problems/valid-anagram/">Valid Anagram</a> is another good LeetCode "starting point." It does not necessarily require a hashmap, but something that acts like a hashmap</li>
<li>Here is <a target="_blank" href="https://www.youtube.com/watch?v=IRN1VcA8CGc">Nick White solving Valid Anagram</a></li>
<li>This is <a target="_blank" href="https://www.youtube.com/watch?v=70qy6_gw1Hc">Alex Lee</a> using hashmaps in Java. He does not explain the internals of how they actually work, but he provides practical advice on how to actually use them.</li>
</ul>
<h3 id="heading-what-to-do-after-you-cover-the-basics">What to do after you cover the basics</h3>
<p>After you get started preparing and are comfortable with the basics, I would refer back to the resources above. </p>
<p>The 30-Minute Guide and <em>Cracking the Coding Interview</em> (again, there are free LeetCode problem mappings if you do not own <em>Cracking the Coding Interview)</em> both cover computer science fundamentals<em>.</em> And <em>14 coding patterns</em> goes a little bit further.</p>
<h2 id="heading-closing-thoughts">Closing Thoughts</h2>
<p>There is a lot more work to be done when it comes to coding interview preparation resources. It is relatively easy for me to simply point to good resources in an aggregate post, but actually providing comprehensive reviews or my own resource would require an order of magnitude more effort. I haven't gotten there yet.</p>
<p>So for now, there is certainly a gap. The most comprehensive content, in my opinion, can be found in <em>Cracking the Coding Interview</em> and this <a target="_blank" href="https://www.youtube.com/watch?v=70qy6_gw1Hc">Educative.io course</a>. And that's not to mention the plethora of resources someone with a lot of money could afford, from coaches, to coding interview bootcamps, to expensive mock interviews in which the interviewers provide detailed feedback. </p>
<p>That the people <em>behind</em> Educative.io and its "coding interview patterns" course have made efforts to provide free resources, like InterviewNoodle and a HackerNoon article, count for a lot to me.</p>
<p>I personally don't really use sites like GeeksforGeeks or interview resources on Github that are written exclusively in markdown. It would be very useful to build a platform with detailed blog-style explanations <em>and</em> embedded coding platforms, but at that point you would essentially be recreating Educative.io.</p>
<p>Medium provides an interesting case: Some of the best writers can be found here, but they are incentivized to put things behind a paywall. Anyone, in theory, can put up articles without a paywall on Medium the way BaseCS has. But few Medium writers seem to do this anymore.</p>
<p>We need <strong>more</strong> high-quality articles. We need practice problem lists that are continually updated. We need great YouTube content creators, like Nick White, to continue to provide clear problem explanations. </p>
<p>Efforts by BaseCS were largely successful, and my one wish is that it had continued to produce content...but this was all produced by a single person with a full-time job, a podcast, a YouTube channel, and apparently no compensation from Medium.</p>
<p>Not everyone has the same level of access to educational coding interview resources, so I admire the people who have done everything in their power to create free alternatives.</p>
<p>Yangshun Tay, author of "The 30-minute guide to rocking your next coding interview", sent me a personal email a few months after this article was published and shared some more helpful resources.</p>
<ul>
<li>Here's a link to the main <a target="_blank" href="https://www.techinterviewhandbook.org/">Tech Interview Handbook Website</a>, which contains in-depth and structured guides that can really help you prep for interviews. </li>
<li>Additionally, he's published <a target="_blank" href="https://www.techinterviewhandbook.org/grind75">Grind75</a> which generates study plans based on time left, which could also be of interest to your readers.</li>
</ul>
<p>The Tech Interview Handbook currently has about 69,000 stars on GitHub, and the website is the closest thing I have seen to a free, "one-stop-shop" software engineer interview resource.  </p>
<p>Grind75 is designed to be a better version of <a target="_blank" href="https://leetcode.com/discuss/general-discussion/460599/blind-75-leetcode-questions">Blind75</a>, a popular list Yangshun also made that received 3200 upvotes on a LeetCode discussion.</p>
<p>I hope these help you out! Happy prepping.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Senior Software Engineer Interview Questions – Tips to Help You Prepare for a Job Interview ]]>
                </title>
                <description>
                    <![CDATA[ By Ankit Sharma I just joined Cisco Systems, India as a Senior Software Engineer (SDE III) on July 28, 2021. I am working with the Cisco Customer Experience team as a UI developer. The entire journey from applying for the job to accepting the offer w... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/senior-software-engineer-interview-questions-how-i-got-a-job-as-an-sde-3-and-how-you-can-prepare-for-the-rounds/</link>
                <guid isPermaLink="false">66d45dcd33b83c4378a517ca</guid>
                
                    <category>
                        <![CDATA[ career advice ]]>
                    </category>
                
                    <category>
                        <![CDATA[ interview questions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Job Interview ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 30 Aug 2021 17:56:48 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/08/pexels-tima-miroshnichenko-5439140.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Ankit Sharma</p>
<p>I just joined <a target="_blank" href="https://www.cisco.com/">Cisco Systems</a>, India as a Senior Software Engineer (SDE III) on July 28, 2021. I am working with the <a target="_blank" href="https://www.cisco.com/c/m/en_us/customer-experience/index.html">Cisco Customer Experience</a> team as a UI developer.</p>
<p>The entire journey from applying for the job to accepting the offer was two months long. I wish to share my interview experience which will help you prepare for a senior-level UI engineer role.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/08/Cisco-logo-2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-what-you-will-get-out-of-this-article">What you will get out of this article?</h2>
<p>In this article, I will talk about my journey, from getting the job referral to accepting the offer. </p>
<p>I will talk about the different rounds of the interview process that I went through and the questions I was asked in them. The questions I share here will help you get ready for Angular development roles. </p>
<p>I will also share some of the questions you can ask the interviewer and the HR rep which will help you to know more about the company and the project.</p>
<p>So, lets’ get started!</p>
<h2 id="heading-how-i-discovered-the-job-posting">How I Discovered the Job Posting</h2>
<p>The first part of a job search is to get your résumé selected for the role you are looking for. I found out about this opportunity from a tweet shared by <a target="_blank" href="https://twitter.com/AlexOkrushko">Alex Okrushko</a>.</p>
<div class="embed-wrapper">
        <blockquote class="twitter-tweet">
          <a href="https://twitter.com/AlexOkrushko/status/1365064874599079947"></a>
        </blockquote>
        <script defer="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></div>
<p>I have been following Alex for the last two years. He used to work with the <a target="_blank" href="https://firebase.google.com/">Firebase</a> team at Google and he is also a part of the <a target="_blank" href="https://ngrx.io/">NgRx</a> team. I admire him for his immense contribution to the Angular community.</p>
<p>Alex is currently working as the Principal UI Architect at Cisco.</p>
<p>When he shared that they were looking for a UI developer, I realized that it would be the best opportunity to work directly with him. I sent a message over Twitter and he asked me to share my résumé. He was primarily looking for developers with strong Angular skills.</p>
<h2 id="heading-the-first-round-of-interviews">The First Round of Interviews</h2>
<p>One week after sharing my résumé with Alex, I received an email for the first round of interviews. </p>
<p>The first step in the interview process was a take-home assignment via <a target="_blank" href="https://devskiller.com/">Devskiller</a>. The invitation from Devskiller mentioned that I had seven days to complete the assignment. The total time allotted for this round was 2.5 hours. Once the test starts, you cannot stop it, so it has to be a single sitting of 2.5 hours.</p>
<p>I was given an Angular project with some bugs in it. There was a total of 11 unit test cases in the project. I was expected to fix all the bugs and make all the test cases green.</p>
<p>I started the test around 10:30pm (after my dinner) and finished it around 12:45am. I am most productive at night, so I chose that time. I was able to fix all the bugs and all the 11 test cases were green too. I slept happily that night 😊</p>
<h3 id="heading-angular-concepts-covered-in-this-round">Angular Concepts Covered in this Round</h3>
<p>The first round of interviews was majorly based around the following Angular concepts:</p>
<ul>
<li>Data binding</li>
<li>Event handling</li>
<li>State ownership and flows</li>
<li>Forms and form validations</li>
<li>Observables</li>
<li>Unit tests using Jasmine</li>
<li>Attribute directives</li>
<li>Structural directives - NgIf &amp; NgFor</li>
</ul>
<p>Alex verified my solution based on bug fixes, unit test status, and coding style. He was impressed with my performance in the first round and so I moved on to round two of the interview.</p>
<h2 id="heading-the-second-round-of-the-interview">The Second Round of the Interview</h2>
<p>I got the email asking for my availability for the second round of the interview. I was facing some health issues at that time, so I asked to schedule a week later and the interviewer was happy to do so.</p>
<p>The second round was also a project-based interview via Devskiller. I was given an Angular project and there are four questions based on that. All the questions are based on debugging and bug fixes. The total time allotted for this round was 1 hour.</p>
<p>The difference compared to the first round was that this time I was supposed to do a live coding session by sharing my screen with Alex. I was expected to explain the What, Why, and How of the code I was writing and talk through the solution. The thought process to approach the problem was given importance over the implementation. </p>
<p>This round was more of a pair-programming session with me in the driver's seat. Out of the four questions, I was able to solve the first three in 30 mins. The last one was based on the concept of Content child/view child. I struggled a bit with this question but a small hint from Alex helped me solve it.</p>
<p>I started the test at 10:30pm and finished it around 11:20pm.</p>
<blockquote>
<p>I was allowed to use online resources during the interview. But the condition was that I had to explain what I was looking for and why.</p>
</blockquote>
<p>At the end of the test, I was able to solve all four questions successfully. The feedback from Alex mentioned that I was struggling with a few of the concepts of RxJS and I need to work on that. But he was happy with my overall performance and I was promoted to the third round of the interview.</p>
<h3 id="heading-angular-concepts-covered-in-this-round-1">Angular Concepts Covered in this Round</h3>
<p>The second round of the interview was primarily based around the following Angular concepts:</p>
<ul>
<li>ViewChild and ViewChildren</li>
<li>ContentChild and ContentChildren</li>
<li>Content projection</li>
<li>Usage of Async pipe</li>
<li>Multicast observables</li>
<li>Parent-child relation of the components</li>
<li>Services</li>
</ul>
<h2 id="heading-the-third-round-of-the-interview">The Third Round of the Interview</h2>
<p>I got a call from my manager, Vaibhav, and he informed me that they were happy with my performance in first two rounds and wanted to schedule another round of technical discussion. </p>
<p>He asked me for my availability and I replied to him to schedule the call for the next day at 10 am IST. This round of interviews is conducted by the team in India so it has to be during IST working hours.</p>
<p>Two interviewers joined the call, and after the introduction, I was informed that this round would be divided into two sections, one for Angular and another one for JavaScript. </p>
<p>They started with the questions about Angular. This round had a mix of theoretical as well as scenario-based questions. The Angular interview continued for around 45 mins and I aced it. I answered all but one question.</p>
<p>After 45 mins they switched to the JS side. They started with the core concepts of JS and I answered those questions easily. Then they moved deeper into JS and I was asked few output-based questions. I struggled a bit here. </p>
<p>Then came more output-based questions and I was unable to answer a few of them. The JS interview also continued for 45 mins. I was not happy with my performance in the JS part of the interview. It was pretty average.</p>
<blockquote>
<p>The interview was originally scheduled for 1 hr, but it got stretched to 1.5 hrs.</p>
</blockquote>
<h3 id="heading-angular-concepts-covered-in-this-round-2">Angular Concepts Covered in this Round</h3>
<p>The third round of the interview was based around the following Angular concepts:</p>
<ul>
<li>RxJS concepts such as mergeMap &amp; switchMap</li>
<li>Directives</li>
<li>How does the ngIf directive work internally? How does it add DOM elements dynamically on the page?</li>
<li>How can we create a custom directive (with practical example)</li>
<li>What is Input and Output in a component?</li>
<li>Few theoretical questions around services, lazy loading of modules, and component communication</li>
</ul>
<h3 id="heading-javascript-concepts-covered-in-this-round">JavaScript Concepts Covered in this Round</h3>
<p>The third round of the interview was based around the following JS concepts:</p>
<ul>
<li>What are the different ways to create and call methods in JS?</li>
<li>Closures</li>
<li>Currying</li>
<li>Event bubbling</li>
<li>Output-based questions on closure and various setTimeout scenarios</li>
</ul>
<h2 id="heading-the-fourth-round-of-the-interview">The Fourth Round of the Interview</h2>
<p>Two days after the third round of interviews, I got a call from Vaibhav. He informed me that the interviewers were impressed with my Angular skills but they were not happy with my JS skills. But the overall performance was good, so I was able to move on to the fourth and the final round of interviews. He also suggested that I work on improving my JS skills.</p>
<p>The final round of interviews was scheduled on the Tuesday of the following week from 12:30pm to 1:30pm.</p>
<p>This was a managerial round and Vaibhav was the interviewer along with another senior developer from my team. This round was more focused on my non-technical skills. </p>
<p>He asked me about the project I was working on with my current company. I was also asked questions about Agile methodology since I had mentioned that in my résumé. I told him about my open-source work and he asked few questions about that.</p>
<p>At the end of the interview, Vaibhav shared that he was happy with my performance and wanted to go ahead with the offer. The next step was to update HR so that they could continue with the salary and the offer formalities.</p>
<h3 id="heading-question-asked-in-the-managerial-round-of-the-interview">Question Asked in the Managerial Round of the Interview</h3>
<p>The fourth round of the interview was entirely non-technical. I have mentioned a few of the questions asked in this round, and here are some more:</p>
<ul>
<li>Tell me about the current project and tech stack you're using.</li>
<li>What is your current role and responsibilities?</li>
<li>What are the Agile practices you are following currently?</li>
<li>How does your sprint planning look like?</li>
<li>How does a story refinement happen in your current project?</li>
<li>How can you resolve a conflict of ideas within your team?</li>
<li>Why are you looking for a change?</li>
<li>Why Cisco?</li>
</ul>
<h2 id="heading-salary-negotiations-and-getting-the-job-offer">Salary Negotiations and Getting the Job Offer</h2>
<p>I was waiting patiently for the call from HR after the fourth round of interviews. I got the call after one week. </p>
<p>The HR rep congratulated me on clearing all the rounds of the interview and asked me about my current salary and notice period. She also asked me to share my payslip and compensation details from my current employer.</p>
<p>After two days, I got another call from HR and she informed me about the salary I was being offered. I asked if there was any possibility of negotiating a better offer. She told me that this was the best possible salary as per my employment grade and it was not possible to increase it any further. I asked her for some time to make the final decision.</p>
<blockquote>
<p>I did not want to lose the job offer but at the same time, I also wanted to have a better salary structure than the one offered.</p>
</blockquote>
<p>I discussed the situation with my family as well as a few of my friends. I also had a call with Vaibhav, and a few calls with HR as well.</p>
<p>I was very much confused at this point, so I decided to write down the pros and cons of this role. Here is what I came up with:</p>
<p><strong>Pros</strong>:</p>
<ul>
<li>The project is customer-facing, so I'd get more exposure and increased responsibilities</li>
<li>Working at the scale of Cisco would be a plus</li>
<li>It would be a great learning and growth opportunity</li>
<li>The brand value of Cisco is high</li>
</ul>
<p><strong>Cons</strong>:</p>
<ul>
<li>The salary offered was not up to my expectations</li>
</ul>
<p>Finally, the pros outweighed the cons and I decided to accept the offer. So, I informed HR of my decision. But there was a surprise waiting for me.</p>
<blockquote>
<p>HR informed me that since I had taken a long time (around 10 days) to decide on the offer, they have put my offer on hold. I needed to wait further for the final confirmation from Cisco’s end.</p>
</blockquote>
<p>I panicked and thought that I had lost the opportunity. But I had no option other than to wait. TBH, I had lost any hope of getting the offer at this point.</p>
<p>After two weeks, I got a call from Vaibhav and he asked me if I was still interested to proceed with the job offer. After my confirmation, he informed me that HR was happy to release the offer letter. The next day, HR called me to confirm the same. By the end of the day, I had the offer letter in my inbox.</p>
<p>I gladly accepted the offer letter. I was relieved and ecstatic. All's well that ends well.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/08/japheth-mast-Ls3yexjyRpk-unsplash.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Job offer accepted</em></p>
<h2 id="heading-how-to-ask-good-questions-in-your-job-interview">How to Ask Good Questions in Your Job Interview</h2>
<p>Whenever you are being interviewed for a job, the interviewer always asks this question at the end – Do you have any questions? </p>
<p>A lot of people are confused about what to ask and what not to ask. Some people do not ask any questions at all. </p>
<p>Well, this is a good opportunity to learn more about the project, the team, and the company. So, you should ask your interviewer as many questions as you can.</p>
<p>Here are a few suggestions from my end.</p>
<h3 id="heading-what-to-ask-the-interviewer-in-a-technical-interview">What to Ask the Interviewer in a Technical Interview</h3>
<ul>
<li>Ask about the details of the project you are being interviewed for</li>
<li>Are you using any third-party tools/libraries in your application? If the answer is yes, ask about them.</li>
<li>How does the code review cycle work?</li>
<li>What are some of the current challenges in the codebase?</li>
<li>What is the ratio of new features vs the bug fixes assigned to a dev?</li>
<li>What testing framework do they use in the application for unit testing as well as E2E testing?</li>
<li>What is the test coverage for the application?</li>
</ul>
<h3 id="heading-what-to-ask-the-interviewer-in-a-managerial-interview">What to Ask the Interviewer in a Managerial Interview</h3>
<ul>
<li>Ask about the details of the project you are being interviewed for</li>
<li>What kind of application it is? Customer-facing or internal?</li>
<li>What will be my roles and responsibilities?</li>
<li>How is the work-life balance in the project?</li>
<li>What are my learning and growth opportunities in the next 1/2/3 years?</li>
<li>What are the current challenges with the project?</li>
<li>Are there any plans to add new features to the application?</li>
<li>Ask about the current team structure and where you will fit in it</li>
<li>How does the team culture look like in the current pandemic situation when we are 100% remote?</li>
<li>What is the working shift for this project? Is it flexible or fixed? Are there any shift allowances provided? This is a very important question and is often neglected by the interviewees.</li>
<li>An extension to the previous question – Does my job require any type of weekend support? If the answer is yes, ask about the timing, frequency per month, and the reimbursement policy around that.</li>
</ul>
<h3 id="heading-what-to-ask-hr-before-accepting-the-offer-or-joining-the-company">What to Ask HR Before Accepting the Offer or Joining the Company</h3>
<ul>
<li>Leave policies</li>
<li>Health insurance policies</li>
<li>WFH policies</li>
<li>What is the timeline of the annual appraisal cycle?</li>
<li>Will I be eligible for the appraisal in the next appraisal cycle?</li>
<li>Do I need to sign any kind of employment bond?</li>
<li>Does this job require me to move to another city/state? </li>
<li>Do I have to serve a probation period upon joining the company? If the answer is yes, ask about the duration and its effect on your employment. Every company has different rules related to probation so ask as many questions as you can around this topic</li>
<li>What are the covid-related benefits company is providing, for example vaccination, medical support, and so on?</li>
</ul>
<h2 id="heading-do-you-want-to-join-the-worlds-best-workplace">Do you Want to Join the World’s Best Workplace?</h2>
<p>Cisco Systems has been ranked number one in Fortune’s list of <a target="_blank" href="https://fortune.com/best-companies/2021/">100 Best Companies to Work For the year 2021</a> and <a target="_blank" href="https://fortune.com/best-workplaces-millennials/2021/">100 Best Large Workplaces for Millennials</a>. Do I need to say anything more about the company’s culture?</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/08/Fortune100Best2021.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Cisco provides you with ample learning and growth opportunities. You will get a chance to work on applications used on a worldwide scale. You will be always motivated to grow and explore yourself on a personal and professional level.</p>
<p>So, what are you waiting for? Go to the <a target="_blank" href="https://jobs.cisco.com/">Cisco Careers portal</a> and apply for the role you want.</p>
<p>I hope my interview experience will be helpful for you. Best of luck with your job interview.</p>
<p>If you like the article, share it with your friends. You can also connect with me on <a target="_blank" href="https://twitter.com/ankitsharma_007">Twitter</a> and <a target="_blank" href="https://www.linkedin.com/in/ankitsharma-007/">LinkedIn</a>. My DMs are always open.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ React Coding Interview – How to Stand Out and Ace the Challenges ]]>
                </title>
                <description>
                    <![CDATA[ By Iva Kop As a React developer, I have gone through my fair share of front-end coding interviews. Recently, I had the opportunity to experience the process from the other side – as an interviewer. Here is what I've learned. Coding interview usually ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-stand-out-during-your-react-coding-interview/</link>
                <guid isPermaLink="false">66d45f3538f2dc3808b790a1</guid>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Job Interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Fri, 20 Aug 2021 18:20:42 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/08/reactinterview.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Iva Kop</p>
<p>As a React developer, I have gone through my fair share of front-end coding interviews. Recently, I had the opportunity to experience the process from the other side – as an interviewer. Here is what I've learned.</p>
<p>Coding interview usually involve a multi-step process where interviewers assess everything from basic technical knowledge to culture fit. Every step of that process is important and should not be underestimated. Prepare for all of it and prepare well.</p>
<p>But there is one thing that is at the core of (almost) every React interview.</p>
<p>Inevitably, at some point, you have to build a React app.</p>
<h1 id="heading-the-app-assignment">The App Assignment</h1>
<p>Here is a short list of real app assignments I had to complete for my own React interviews over the years:</p>
<ul>
<li><strong>Support Desk app</strong> – an app to display a list of support desk employees and their contact information.</li>
<li><strong>Video app</strong> – an app where, given a YouTube video URL, it displays it on the page. Users can comment on it.</li>
<li><strong>Projects app</strong> – an app to display a list of on-going projects that users can subscribe to and follow.</li>
<li><strong>Articles app</strong> – an app to display a list of articles where users can leave nested comments for each one.</li>
</ul>
<p>These assignments are, in many ways, very similar to each other. The reason is that they are assessing the same set of basic React skills. Which skills are those? Let's break them down.</p>
<h2 id="heading-interview-skill-1-how-to-build-uis-with-react">Interview Skill #1 – How to Build UIs with React</h2>
<p>A primary job of a React developer is to build and structure React components in a meaningful way. </p>
<p>The assignments above are meant to test your ability to write code in a modular and reusable way while creating abstractions at the right level. </p>
<p>The main goal is for your app to work well. But, as a front-end developer, you are also expected to build UIs that look good, too.</p>
<p>Most of the time, the assignment will come with a concrete design you'll need to follow. If that is the case, it's important to stick closely to it. </p>
<p>But if you believe that there is a good reason to deviate, don't hesitate to do so. Just be prepared to explain why your solution is better.</p>
<p>If there is no design available, the interviewer is probably interested in understanding if you can create sensible UIs on your own. Although this could be more challenging, it also gives you the opportunity to show you are able to make conscious choices when it comes to the front-end.</p>
<p><strong>Tip:</strong> It is easy to assume that the expectation is that you have to build all components from scratch. Using a third party component library might feel like cheating in an interview context. But it is not! </p>
<p>Make sure to ask in advance what is expected. Taking advantage of component libraries like <a target="_blank" href="https://material-ui.com/">MaterialUI</a> or <a target="_blank" href="https://chakra-ui.com/">ChakraUI</a>  is a huge time saver during interview assignments and will allow you to focus on more interesting parts of the app.</p>
<h2 id="heading-interview-skill-2-state-management-in-react">Interview Skill #2 – State Management in React</h2>
<p>Another important challenge when it comes to building React apps is state management. There is a myriad of ways to go about this depending on your concrete use case and goals. Check out <a target="_blank" href="https://blog.whereisthemouse.com/how-to-think-about-react-state-management">my article</a> on the topic if you are curious to learn more.</p>
<p>Whatever approach you choose, what is important during as interview assignment is to show the interviewer that you understand and are able to reason about state management. </p>
<p>Your solution needs to make sense without being overly complex or convoluted. Be prepared to explain and defend your choices.</p>
<p><strong>Tip:</strong> It is a good idea to match your state management solution to the one used by the company your are interviewing for. </p>
<p>Do they use Redux? Then don't hesitate to include Redux in your project. Are they into state machines? Then xState is your friend, and so on. Make sure to ask the interviewer in advance what they would like to see implemented in your project.</p>
<h2 id="heading-interview-skill-3-data-fetching-in-react">Interview Skill #3 – Data-fetching in React</h2>
<p>As a front-end developer, normally you won't be expected to build your own back-end. But the assignment you are given will probably involve some form of data-fetching – likely either through a mock API of some kind or just a JSON file with the necessary data.</p>
<p>This part of the assignment is meant to test if you, as a front-end developer, know how to talk to the back-end. Can you get, display and update the data you receive from the back-end correctly? Do you understand how API requests work? </p>
<p>In a more advanced setting, there might be a conversation about data-fetching architecture, data state management, and front-end caching.</p>
<p><strong>Tip:</strong> Make an effort to implement a semi-realistic data-fetching mechanism in your app. In you are given a JSON file, don't just directly import the data in your components. Instead, use <code>fetch</code> or another more advanced (preferably async) approach to get it so that you are able to demonstrate your deeper understanding.</p>
<h2 id="heading-interview-skill-4-routing-in-react">Interview Skill #4 – Routing in React</h2>
<p>A lot of the time, creating a React project is synonymous with a single page application. So it is possible that the assignment involves implementing a routing solution. </p>
<p>Here the goal is to demonstrate that you understand the basics of client-side routing and are able to structure your app around it.</p>
<p><strong>Tip:</strong> Avoid creating your own client-side routing implementation, unless explicitly required. Opting for <a target="_blank" href="https://reactrouter.com/">React Router</a> or <a target="_blank" href="https://reach.tech/router/">Reach Router</a> is a perfectly acceptable choice.</p>
<h1 id="heading-how-to-stand-out-in-a-react-interview">How to Stand Out in a React Interview</h1>
<p>Getting a solid grasp on the basics discussed above is a must and it's a good start to earn points during an interview assignment. But to truly stand out, you have to go a step further.</p>
<p>Here is how.</p>
<h2 id="heading-understand-your-setup">Understand Your Setup</h2>
<p>Most of the time you can get away with using toolchains like Create React App (or similar) when building a React project for an interview. This will help you get started and save time. </p>
<p>In fact, it is important to use those tools in order to spend your time on meaningful development rather than setup. </p>
<p>But it's also important to understand and be able to explain the basic tooling you are using. During a React interview, expect to be asked questions about <a target="_blank" href="https://webpack.js.org/">Webpack</a> and <a target="_blank" href="https://babeljs.io/">Babel</a>, for example.</p>
<p>But what can really give you an edge is if you not only understand but are able to enhance your existing setup. One idea would be to add a linter (<a target="_blank" href="https://eslint.org/">eslint</a>) and a formatter (<a target="_blank" href="https://prettier.io/">prettier</a>) to your app. This shows that you really care about code quality and consistency.</p>
<p>Another would be to go even further and setup pre-commit hooks (<a target="_blank" href="https://github.com/typicode/husky">husky</a>) that lint and format your code with each commit. Crazy, I know!</p>
<p>These tools take minutes to setup but can seem like an impressive extra step in the eyes on an interviewer.</p>
<h2 id="heading-test-your-code">Test Your Code</h2>
<p>Very few assignments will explicitly state that tests are required. For this reason, many developers assume tests are not part of the task and completely ignore them. This is wrong!</p>
<p>Most of the time, an interviewer will be impressed to see that you understand the importance of testing your code. It is a very easy but powerful way to set yourself apart. </p>
<p>It is not necessary to have a test for every single line of code in your project. Several strategically selected tests covering the more complicated logic should do the trick just fine.</p>
<h2 id="heading-dont-ignore-responsiveness">Don't Ignore Responsiveness</h2>
<p>Here is another aspect of your React assignment that is not explicitly mentioned most of the time – responsiveness. </p>
<p>Even if you are given a design at the beginning of the task, almost always it will not be a responsive one. It is up to you care enough about responsiveness to figure it out on your own.</p>
<p>Same as testing, most developers will just ignore responsiveness. Which is good news for you – it gives you the opportunity to shine!</p>
<p>There is no need for the implementation to be perfect and work flawlessly on every screen and device. The mere fact that this is something you though about in your development process should be enough to score you some major points.</p>
<h2 id="heading-improve-accessibility">Improve Accessibility</h2>
<p>Accessibility is a huge concern for most modern web products. Taking even minor steps to improve the accessibility of your project, like adding <code>alt</code> text to your images, for example, can leave a really good impression.</p>
<p>Accessibility is also another reason why you might want to choose a third-party component library when building your assignment. Most components in these libraries are accessible out of the box.</p>
<p>Making your project as accessible as possible can truly make you stand out in an interview. But what is more, accessibility should be (and is becoming) the norm in web development. Make sure your future employer knows you understand that.</p>
<h2 id="heading-details-matter">Details Matter</h2>
<p>Everything in your code should tell the interviewer you are a competent developer – from basics like the way you name and structure your code to minor details like commit messages. </p>
<p>Given that these assignments are usually done under time constraints, it is tempting to just ignore these seemingly unimportant aspects. But getting them right can meaningfully set you apart.</p>
<p>Hopefully this article is useful for your next React interview. Let me know how it goes!</p>
<p><a target="_blank" href="https://twitter.com/iva_kop">Follow me</a> on Twitter for more tech content.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Coding Interview Tree Traversal Crash Course – The Only One You'll Ever Need ]]>
                </title>
                <description>
                    <![CDATA[ Are you preparing for coding interviews? I designed a crash course series to help you out. I'm Lynn, a software engineer and a recent graduate from the University of Chicago. This is the second course in my Coding Interview Crash Course Series. Feel ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/coding-interview-tree-traversal-crash-course-the-only-one-youll-ever-need/</link>
                <guid isPermaLink="false">66d4601755db48792eed3f73</guid>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ interview questions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Trees ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Lynn Zheng ]]>
                </dc:creator>
                <pubDate>Mon, 16 Aug 2021 23:49:03 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/08/tree-thumb.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Are you preparing for coding interviews? I designed a crash course series to help you out.</p>
<p>I'm Lynn, a software engineer and a recent graduate from the University of Chicago. This is the second course in my Coding Interview Crash Course Series. Feel free to check out <a target="_blank" href="https://www.youtube.com/channel/UCZ2MeG5jTIqgzEMiByrIzsw">my YouTube channel, Lynn's DevLab</a>, to stay updated on this series.</p>
<p>This crash course is about Tree Traversal. If you just want to dive right in, <a target="_blank" href="https://youtu.be/uaeCfsCcYWo">you can find the course here</a> (and linked at the bottom of this article). If you want a little more info, read on. 😎</p>
<h2 id="heading-who-is-the-course-for-and-what-are-tree-traversal-algorithms">Who is the Course for and What are Tree Traversal Algorithms? 🌳</h2>
<p>You will get the most of this course if you already know a bit about the <strong>Tree</strong> data structure. Check out <a target="_blank" href="https://www.freecodecamp.org/news/binary-data-structures-an-intro-to-trees-and-heaps-in-javascript-962ab536cb42/">these</a> <a target="_blank" href="https://www.freecodecamp.org/news/the-codeless-guide-to-tree-data-structures/">tutorials</a> if you need a refresher.</p>
<p>We will cover the traversal algorithms for both <strong>Binary Trees</strong> and <strong>N-ary Trees</strong> (in which each parent node has an arbitrary number of children).</p>
<p>If you have heard about Binary Search Trees (BST) before, that's a special type of Binary Tree so the techniques we are going to learn here also apply.</p>
<p>Trees are a favorite interview subject among top tech companies like Google, Microsoft, and Facebook, so let's crunch this topic!</p>
<p>We will learn about four traversal techniques and solve their corresponding LeetCode problems hands-on.</p>
<p>The four techniques are:</p>
<ul>
<li><p><strong>Pre-order (Depth-First Search, DFS)</strong></p>
</li>
<li><p><strong>Post-order</strong></p>
</li>
<li><p><strong>In-order</strong></p>
</li>
<li><p><strong>Level-order (Breadth-First Search, BFS).</strong></p>
</li>
</ul>
<h2 id="heading-course-outline">Course Outline</h2>
<p>This course video runs for a total of 30 minutes and features:</p>
<ul>
<li><p>A high-level description of the four traversal techniques: <strong>pre-order, post-order, in-order, and level-order</strong></p>
</li>
<li><p><strong>Recursive</strong> implementations of pre-order, post-order, and in-order (Note: this doesn't apply to level-order)</p>
</li>
<li><p><strong>Iterative</strong> implementations of pre-order, post-order, in-order, and level-order</p>
</li>
<li><p>An extension of the templates from <strong>Binary Trees</strong> to <strong>N-ary Trees</strong></p>
</li>
</ul>
<p>Let's dive into each of the four techniques below.</p>
<h2 id="heading-tree-traversal-demonstration-using-an-example-tree">Tree Traversal Demonstration Using an Example Tree</h2>
<p>We will use the following tree to demonstrate the output from the four traversal techniques.</p>
<p>Note that this tree is a simple Binary Tree, not a Binary Search Tree (BST). A BST is a special type of Binary Tree, so our techniques also apply. Also, <strong>in-order traversal</strong> becomes especially interesting when we work with a BST, as we will see below.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/08/Screen-Shot-2021-08-16-at-2.48.44-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>An example Binary Tree. Note that it's not a Binary Search Tree (BST).</em></p>
<p>Given this tree, the traversal result from the four techniques are as follows:</p>
<ul>
<li><p>Pre-order: 1, 2, 4, 5, 3</p>
</li>
<li><p>Post-order: 4, 5, 2, 3, 1</p>
</li>
<li><p>In-order: 4, 2, 5, 1, 3</p>
</li>
<li><p>Level-order: 1, 2, 3, 4, 5</p>
</li>
</ul>
<h3 id="heading-pre-order-traversal">Pre-order Traversal</h3>
<p>Pre-order traversal is also known as <strong>Depth-First Search (DFS)</strong> if we analyze the tree as a graph and take the tree root node as our starting node in the search.</p>
<p>As in the example above, we go all the way down to the <strong>leftmost</strong> node before visiting any other node that is a left child of some parent node.</p>
<p>Pre-order traversal allows us to explore roots before leaves, and is hence ideal for tasks like copying a tree.</p>
<h3 id="heading-post-order-traversal">Post-order Traversal</h3>
<p>Post-order traversal does the opposite of pre-order traversal, allowing us to explore leaves before roots.</p>
<h3 id="heading-in-order-traversal">In-order Traversal</h3>
<p>In-order traversal is especially useful for flattening a tree into an array representation.</p>
<p>For a Binary Search Tree like below, in-order traversal outputs an array in a sorted, non-decreasing order: -4, 3, 2, 5, 18.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/08/Screen-Shot-2021-08-16-at-2.51.44-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Binary Search Tree example</em></p>
<h3 id="heading-level-order-traversal">Level-order Traversal</h3>
<p>Level-order traversal is also known as <strong>Breadth-First Search (BFS)</strong> if we consider the tree as a graph and start our search from the tree root node.</p>
<p>We visit every node on the current level (depth) before moving onto those on the next level. Effectively, we visit the immediate neighbor of (one step away from) our current node before visiting neighbors that are farther away.</p>
<h2 id="heading-how-to-implement-these-four-techniques">How to Implement these Four Techniques</h2>
<p>We will use the following definition for a node of a Binary Tree:</p>
<pre><code class="lang-python"><span class="hljs-comment"># Definition for a binary tree node.</span>
<span class="hljs-comment"># class TreeNode:</span>
<span class="hljs-comment">#     def __init__(self, val=0, left=None, right=None):</span>
<span class="hljs-comment">#         self.val = val</span>
<span class="hljs-comment">#         self.left = left</span>
<span class="hljs-comment">#         self.right = right</span>
</code></pre>
<h3 id="heading-recursive-implementation">Recursive implementation</h3>
<p>Recursive implementations are the most straightforward. The most important thing to remember is the order in which we concatenate the results from the two recursive calls (one on the left subtree and one on the right subtree) with the value of the current node.</p>
<pre><code class="lang-pgsql">def preorder(root):
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    <span class="hljs-keyword">return</span> [root.val] + preorder(root.left) + preorder(root.right)
</code></pre>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">postorder</span>(<span class="hljs-params">root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    <span class="hljs-keyword">return</span> postorder(root.left) + postorder(root.right) + [root.val]
</code></pre>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">inorder</span>(<span class="hljs-params">root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    <span class="hljs-keyword">return</span> inorder(root.left) + [root.val] + inorder(root.right)
</code></pre>
<h3 id="heading-iterative-implementation">Iterative implementation</h3>
<p>Compared to recursive implementations, iterative implementations are non-trivial. Most require that we use either a stack or a queue to keep track of the nodes that we need to visit.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">preorder</span>(<span class="hljs-params">self, root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    ret = []
    stack = [root]
    <span class="hljs-keyword">while</span> stack:
        node = stack.pop()
        ret.append(node.val)
        <span class="hljs-comment"># note that we append the right child before the left child</span>
        <span class="hljs-keyword">if</span> node.right:
            stack.append(node.right)
        <span class="hljs-keyword">if</span> node.left:
            stack.append(node.left)
    <span class="hljs-keyword">return</span> ret
</code></pre>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">postorder</span>(<span class="hljs-params">self, root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    <span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> deque
    ret = deque()
    stack = [root]
    <span class="hljs-keyword">while</span> stack:
        node = stack.pop()
        ret.appendleft(node.val)
        <span class="hljs-keyword">if</span> node.left:
            stack.append(node.left)
        <span class="hljs-keyword">if</span> node.right:
            stack.append(node.right)
    <span class="hljs-keyword">return</span> ret
</code></pre>
<p>The implementation for in-order traversal looks quite different from pre-order and post-order:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">inorder</span>(<span class="hljs-params">self, root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    ret = []
    stack = []
    <span class="hljs-keyword">while</span> root <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span> <span class="hljs-keyword">or</span> stack:
        <span class="hljs-keyword">while</span> root <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
            stack.append(root)
            root = root.left
        root = stack.pop()
        ret.append(root.val)
        root = root.right
    <span class="hljs-keyword">return</span> ret
</code></pre>
<p>Lastly, we have level-order traversal, where we will output the result as <code>[[nodes on the first level], [nodes on the second level], [nodes on the third level], ...]</code>.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">levelorder</span>(<span class="hljs-params">self, root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    ret = []
    <span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> deque
    queue = deque([root])
    <span class="hljs-keyword">while</span> queue:
        ret_row = []
        <span class="hljs-comment"># fixed size for current level</span>
        <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> range(len(queue)):
            node = queue.popleft()
            ret_row.append(node.val)
            <span class="hljs-keyword">if</span> node.left:
                queue.append(node.left)
            <span class="hljs-keyword">if</span> node.right:
                queue.append(node.right)
        ret.append(ret_row)
    <span class="hljs-keyword">return</span> ret
</code></pre>
<h3 id="heading-n-ary-trees">N-ary Trees</h3>
<p>We now extend our templates from handling Binary Trees to handling N-ary Trees. We use the following definition for the node of an N-ary Tree:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Node</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, val=None, children=[]</span>):</span>
        self.val = val
        self.children = children
</code></pre>
<p>To extend our iterative implementations to handle N-ary Trees, all we need to do is to make sure that we are appending the child nodes that we will visit in a correct order.</p>
<p>Recall that in pre-order traversal, we appended the right child before the left child. So when appending the children of a node of an N-ary Tree, we need to reverse the list of children.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">preorder</span>(<span class="hljs-params">self, root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    ret = []
    stack = [root]
    <span class="hljs-keyword">while</span> stack:
        node = stack.pop()
        ret.append(node.val)
        <span class="hljs-comment"># reverse the list of children</span>
        <span class="hljs-keyword">for</span> child <span class="hljs-keyword">in</span> node.children[::<span class="hljs-number">-1</span>]:
            stack.append(child)
    <span class="hljs-keyword">return</span> ret
</code></pre>
<p>For the other traversal techniques, since we are appending the children from the left to the right, we can iterative over the list of children normally:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">postorder</span>(<span class="hljs-params">self, root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    <span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> deque
    ret = deque()
    stack = [root]
    <span class="hljs-keyword">while</span> stack:
        node = stack.pop()
        ret.appendleft(node.val)
        <span class="hljs-keyword">for</span> child <span class="hljs-keyword">in</span> node.children:
            stack.append(child)
    <span class="hljs-keyword">return</span> ret
</code></pre>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">levelorder</span>(<span class="hljs-params">self, root</span>):</span>
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> root:
        <span class="hljs-keyword">return</span> []
    ret = []
    <span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> deque
    queue = deque([root])
    <span class="hljs-keyword">while</span> queue:
        ret_row = []
        <span class="hljs-comment"># fixed size for current level</span>
        <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> range(len(queue)):
            node = queue.popleft()
            ret_row.append(node.val)
            <span class="hljs-keyword">for</span> child <span class="hljs-keyword">in</span> node.children:
                queue.append(child)
        ret.append(ret_row)
    <span class="hljs-keyword">return</span> ret
</code></pre>
<p>And now we can apply our tree traversal templates to trees that have an arbitrary number of children at each node.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this crash course on tree traversal, we learned four techniques: pre-order, post-order, in-order, and level-order. We discussed how they differ and what tasks they are best for.</p>
<p>We also implemented them both in a recursive fashion and in an iterative one. Last but not least, we extended the techniques to deal with not only Binary Trees, but N-ary Trees.</p>
<p>I hope now you feel more confident about tree traversal interview questions. This is also a nice segue into the topic of my next crash course on graph traversal.</p>
<p>With the knowledge of pre-order traversal and level-order traversal, DFS and BFS won't be completely out of the blue for you 🤓 I will even talk about how I applied graph traversal when developing an algorithm for <a target="_blank" href="https://github.com/RuolinZheng08/unity-clicky-galaxy">my match-three game, Clicky Galaxy,</a> so stay tuned!</p>
<h2 id="heading-resources">Resources</h2>
<p>Watch the course here:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/uaeCfsCcYWo" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<p>Access the code template on my GitHub:</p>
<div class="gist-block embed-wrapper" data-gist-show-loading="false" data-id="f6e55b09eb096fe5fe630249cd859b07">
        <script src="https://gist.github.com/RuolinZheng08/f6e55b09eb096fe5fe630249cd859b07.js"></script></div><p> </p>
<p>Check out the whole crash course series:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/undefined" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<p>And lastly, feel free to subscribe to my YouTube channel for more content like this :)</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/undefined" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ JavaScript Interview Prep Cheatsheet – Ace Your Coding Interviews with These Concepts ]]>
                </title>
                <description>
                    <![CDATA[ By rajat gupta I've carefully gone through over 50 resources, I've been through 10 JavaScript interviews, and I've landed a job at a unicorn startup. And throughout this entire process, I started to see a pattern in the most frequently asked JS inter... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/javascript-interview-prep-cheatsheet/</link>
                <guid isPermaLink="false">66d460c53bc3ab877dae2228</guid>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 07 Jul 2021 15:43:17 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/06/JS-Interview--2-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By rajat gupta</p>
<p>I've carefully gone through over <strong>50</strong> resources, I've been through <strong>10</strong> JavaScript interviews, and I've landed a <strong>job</strong> at a unicorn startup.</p>
<p>And throughout this entire process, I started to see a <em>pattern</em> in the most frequently asked JS interview questions. </p>
<p>In this article, I have tried to list the concepts which will cover <strong>80%</strong> of any good JS interview.</p>
<p>So, if you are prepping for your next JS interview this is the perfect cheatsheet for you to review and solidify your skills. Go through this and you'll be ready to rock. 💃</p>
<h2 id="heading-prerequisites">📝Prerequisites</h2>
<ul>
<li>Basic knowledge of the web and programming</li>
<li>Familiarity with HTML/CSS and JavaScript (especially ES6+ syntax)</li>
</ul>
<h2 id="heading-table-of-contents">Table Of Contents 📜</h2>
<ul>
<li><a class="post-section-overview" href="#heading-javascript-basics">JavaScript Basics</a> – JS Variables and Array Methods</li>
<li><a class="post-section-overview" href="#heading-functional-programming-in-javascript">Functional Programming in JavaScript</a> – Scope, Closures, and Hoisting</li>
<li><a class="post-section-overview" href="#heading-objects-in-javascript">Objects in JavaScript</a> – Prototypes and "this"</li>
<li><a class="post-section-overview" href="#heading-asynchronous-javascript">Asynchronous JavaScript</a> – Event Loops, Timers, and Promises</li>
<li><a class="post-section-overview" href="#heading-advanced-javascript-concepts-to-know">Advanced JavaScript Concepts to Know</a> - Async/defer, Polyfills, Debouncing, and Throttling </li>
<li><a class="post-section-overview" href="#heading-storage-in-javascript">Storage in JavaScript</a></li>
</ul>
<p><strong>Caveat:</strong> The focus here will largely be to cover concepts relevant to the interview and not to create a comprehensive booklet for learning the language. Treat this more like a cheatsheet.</p>
<p>If you want to dive in deeply and learn more JS concepts, check out <a target="_blank" href="https://www.freecodecamp.org/learn/">freeCodeCamp's curriculum</a>.</p>
<p>With that out of the way - let's go!</p>
<h2 id="heading-javascript-basics">JavaScript Basics 👶</h2>
<p>Let's start off with some basic concepts every JS developer needs to know.</p>
<h3 id="heading-variables-in-javascript">Variables in JavaScript 📥</h3>
<p>Variables are the building blocks of every programming language. You use them to store values. A variable can be a number, string, and many other types. </p>
<p>Now, JS is a <em>loosely-typed</em> language. You don't have to state the type of variable. You can just declare it, and JS will figure it out on its own. </p>
<p>Now, in JavaScript we have <strong>3</strong> ways to declare variables: <code>var</code>, <code>let</code>, and <code>const</code>.</p>
<p>Here are the key differences: </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/-wnr0JLxh.png" alt="-wnr0JLxh" width="600" height="400" loading="lazy"></p>
<p>Let's try to understand them through examples.</p>
<p>We will cover scope later on. For now, let's focus on the other differences.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a = <span class="hljs-number">3</span>
<span class="hljs-keyword">var</span> a = <span class="hljs-number">4</span>

<span class="hljs-built_in">console</span>.log(a) <span class="hljs-comment">// 4 as var variables can be redeclared + updated</span>

<span class="hljs-keyword">let</span> b = <span class="hljs-number">3</span>
<span class="hljs-keyword">let</span> b = <span class="hljs-number">4</span>

<span class="hljs-built_in">console</span>.log(b) <span class="hljs-comment">// Syntax Error as let variables cannot be redeclared</span>

<span class="hljs-comment">// If we just do, it will work because it can be updated</span>
b = <span class="hljs-number">4</span> 

<span class="hljs-keyword">const</span> c = <span class="hljs-number">3</span>
<span class="hljs-keyword">const</span> c = <span class="hljs-number">4</span>

<span class="hljs-built_in">console</span>.log(c) <span class="hljs-comment">// Syntax Error as const variables cannot be redeclared or updated</span>

<span class="hljs-keyword">const</span> d

<span class="hljs-comment">// Will this throw an error? Go through the table and try to find the answer.</span>
</code></pre>
<p><strong>Note:</strong> In JavaScript, putting a semi-colon after the end of statement is optional. I will be skipping it here for the sake of readability.</p>
<h3 id="heading-vs-in-javascript">== vs === in JavaScript</h3>
<p>Let's compare some variables. There are two ways you can do that.</p>
<p><code>==</code> only checks for the value</p>
<p><code>===</code> checks for value + type</p>
<pre><code class="lang-javascript">
<span class="hljs-keyword">let</span> a = <span class="hljs-number">5</span> <span class="hljs-comment">// number</span>
<span class="hljs-keyword">let</span> b = <span class="hljs-string">'5'</span> <span class="hljs-comment">// string</span>

<span class="hljs-built_in">console</span>.log(a == b) <span class="hljs-comment">// true</span>

<span class="hljs-built_in">console</span>.log(a === b) <span class="hljs-comment">// false</span>
</code></pre>
<h3 id="heading-arrays-in-javascript">Arrays in JavaScript</h3>
<p>Now that we know a bit about variables, let's move on to arrays and array-methods. </p>
<p>If we have declared a lot of variables, it makes sense to store them somewhere. Otherwise it will be difficult to keep track of all of them. Arrays are one way of storing a variable. </p>
<pre><code class="lang-javascript">
<span class="hljs-keyword">let</span> a = <span class="hljs-number">4</span>
<span class="hljs-keyword">const</span> b = <span class="hljs-number">5</span>
<span class="hljs-keyword">var</span> c = <span class="hljs-string">'hello'</span>

<span class="hljs-keyword">const</span> array = [a, b, c]

<span class="hljs-comment">// or you can just directly do</span>

<span class="hljs-keyword">const</span> arr = [<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-string">'hello'</span>]
</code></pre>
<p>But only storing variables in an array is kind of boring. We can do more <em>stuff</em> with this array (like accessing these variables or changing the order in which they are stored or how they are stored). </p>
<p>For that, JS has a lot of methods. Let's look at some of them now.</p>
<h2 id="heading-javascript-array-methods">JavaScript Array Methods 🧰</h2>
<p>The most frequently used array methods in JS are: <code>map</code>, <code>filter</code>, <code>find</code>, <code>reduce</code>, and <code>forEach</code>.</p>
<p>Let's cover <code>map</code>, <code>filter</code>, and <code>forEach</code>. You can explore more in <a target="_blank" href="https://www.freecodecamp.org/news/complete-introduction-to-the-most-useful-javascript-array-methods/">this helpful article</a>.</p>
<h3 id="heading-the-map-array-method">The <code>map</code> array method</h3>
<p><code>map</code> creates a new copy of the original array. We use it when we want to do something with the elements of the original array but don't want to change it.</p>
<p><code>map</code> iterates over the original array and takes a callback function (which we'll cover later) as an argument. In the callback function, we tell it what to do with the elements.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> a = [<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>]

<span class="hljs-comment">// Create a new array which multiplies every element by 2</span>

<span class="hljs-keyword">const</span> d = a.map(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">item</span>)</span>{ <span class="hljs-keyword">return</span> item*<span class="hljs-number">2</span> })

<span class="hljs-built_in">console</span>.log(d) <span class="hljs-comment">// [2,4,6,8,10]</span>
</code></pre>
<h3 id="heading-the-filter-array-method">The <code>filter</code> array method</h3>
<p><code>filter</code> creates a new array with elements that meet the given condition(s).</p>
<p>Let's look at an example. I have used <a target="_blank" href="https://www.freecodecamp.org/news/arrow-function-javascript-tutorial-how-to-declare-a-js-function-with-the-new-es6-syntax/">arrow functions</a> here. If you are a little uncomfortable with functions, you can cover the next section first and come back.</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// Return the words with more than 6 letters</span>
<span class="hljs-keyword">const</span> words = [<span class="hljs-string">'react'</span>, <span class="hljs-string">'script'</span>, <span class="hljs-string">'interview'</span>, <span class="hljs-string">'style'</span>, <span class="hljs-string">'javascript'</span>]

<span class="hljs-keyword">const</span> ans = words.filter(<span class="hljs-function">(<span class="hljs-params">word</span>) =&gt;</span> word.length &gt; <span class="hljs-number">6</span>)

<span class="hljs-built_in">console</span>.log(ans) <span class="hljs-comment">// ['interview', 'javascript']</span>
</code></pre>
<p>Try to do the exercises yourself first to test your knowledge. If you come up with different or better solutions, let me know!</p>
<p>Generally, a follow up to this: can you do it without the array method?</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">let</span> newArr = []

<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; words.length; i++) {
  <span class="hljs-keyword">if</span> (words[i].length &gt; <span class="hljs-number">6</span>) {
    newArr.push(words[i])
  }
}
<span class="hljs-built_in">console</span>.log(newArr)
</code></pre>
<h3 id="heading-the-foreach-array-method">The <code>forEach</code> array method</h3>
<p><code>forEach</code> is very similar to <code>map</code> but has two key differences:</p>
<p>First of all, <code>map</code> returns a new Array, but <code>forEach</code> doesn't.</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// Return a new array where even numbers are multiplied by 2 </span>
<span class="hljs-keyword">let</span> arr = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>]

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">consoleEven</span>(<span class="hljs-params">arr</span>) </span>{
  <span class="hljs-keyword">let</span> data = arr.map(<span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> (num % <span class="hljs-number">2</span> === <span class="hljs-number">0</span> ? num * <span class="hljs-number">2</span> : num * <span class="hljs-number">1</span>))

  <span class="hljs-built_in">console</span>.log(data)  <span class="hljs-comment">// [1,  4, 3, 8, 5, 12, 7]</span>
}


<span class="hljs-comment">// ? is the ternary operator. If the condition is true - first statement is returned otherwise the second one.</span>


consoleEven(arr)
</code></pre>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">consoleEven</span>(<span class="hljs-params">arr</span>) </span>{
  <span class="hljs-keyword">let</span> data = arr.forEach(<span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> (num % <span class="hljs-number">2</span> === <span class="hljs-number">0</span> ? num * <span class="hljs-number">2</span> : num * <span class="hljs-number">1</span>))
  <span class="hljs-built_in">console</span>.log(data) <span class="hljs-comment">// undefined</span>
}

consoleEven(arr)
</code></pre>
<p>And second, you can do method chaining in <code>map</code> but not in <code>forEach</code>.</p>
<pre><code class="lang-javascript">
<span class="hljs-comment">// Convert  the new array back to original</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">consoleEven</span>(<span class="hljs-params">arr</span>) </span>{
  <span class="hljs-keyword">let</span> data = arr
    .map(<span class="hljs-function">(<span class="hljs-params">num</span>) =&gt;</span> (num % <span class="hljs-number">2</span> === <span class="hljs-number">0</span> ? num * <span class="hljs-number">2</span> : num * <span class="hljs-number">1</span>))
    .map(<span class="hljs-function">(<span class="hljs-params">item</span>) =&gt;</span> (item % <span class="hljs-number">2</span> === <span class="hljs-number">0</span> ? item / <span class="hljs-number">2</span> : item / <span class="hljs-number">1</span>))

  <span class="hljs-built_in">console</span>.log(data)
}

consoleEven(arr)
</code></pre>
<p><strong>Note:</strong> <code>map</code> and <code>forEach</code> don't mutate (change) the original array.</p>
<h2 id="heading-functional-programming-in-javascript">Functional Programming in JavaScript 🛠</h2>
<p>We have already used functions above. Let's cover them in more detail now. </p>
<p>Just like how we used variables to store values, we can use functions to store a piece of code which we can reuse.</p>
<p>You can make function in two ways:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">a</span>(<span class="hljs-params"></span>)</span>{
 <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'I am a normal function'</span>);
 }

<span class="hljs-keyword">const</span> b = <span class="hljs-function">() =&gt;</span> {
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'I am an arrow function'</span>)
}

<span class="hljs-comment">// They are essentially the same but with a few differences which we will cover as we go along this tutorial. </span>

<span class="hljs-comment">// We can pass variables as arguments</span>

<span class="hljs-keyword">const</span> c = <span class="hljs-function">(<span class="hljs-params">name</span>) =&gt;</span> {
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">`My name is <span class="hljs-subst">${name}</span>`</span>)
}

<span class="hljs-comment">// `` template literal are a new addition to the language. Very useful for string formatting. Values are accessed using ${} inside them.</span>


<span class="hljs-comment">// We can even pass functions as arguments to a function. Will see more on this when we try to understand closures.</span>

<span class="hljs-keyword">const</span> greet = <span class="hljs-function">() =&gt;</span>  {
    <span class="hljs-keyword">const</span> prefix = <span class="hljs-string">'Mr'</span>
    <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">name</span>) =&gt;</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${prefix}</span> <span class="hljs-subst">${name}</span>, welcome!`</span>)
    }
}

<span class="hljs-built_in">console</span>.log(greet()(<span class="hljs-string">'Jack'</span>))
</code></pre>
<p>Now, let's cover some important concepts related to functions.</p>
<h3 id="heading-function-scope-in-javascript">Function Scope in JavaScript 🕵️</h3>
<p>Scope determines from where the variables are accessible.</p>
<p>There are three types of scope:</p>
<ul>
<li>Global (declaration outside of any function)</li>
<li>Function (declaration inside a function)</li>
<li>Block (declaration inside a block)</li>
</ul>
<p>Remember from before that <code>var</code> is globally scoped whereas <code>let</code> and <code>const</code> are block scoped. Let's understand that now.</p>
<pre><code class="lang-javascript">
<span class="hljs-keyword">var</span> a = <span class="hljs-number">5</span> <span class="hljs-comment">// we can access this a anywhere</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">adder</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-keyword">let</span> b = <span class="hljs-number">7</span>
    <span class="hljs-built_in">console</span>.log(a + b)
 }

<span class="hljs-built_in">console</span>.log(adder())

<span class="hljs-built_in">console</span>.log(b) <span class="hljs-comment">// Error as b is not accessible outside the function</span>

{
<span class="hljs-keyword">const</span> c = <span class="hljs-number">10</span>
<span class="hljs-built_in">console</span>.log(c) <span class="hljs-comment">// 10</span>
}

<span class="hljs-built_in">console</span>.log(c) <span class="hljs-comment">// Error as c is not accessible outside the block</span>
</code></pre>
<h3 id="heading-closures-in-javascript-important">Closures in JavaScript (❗important) 🔒</h3>
<p>We have already used a closure without even realizing it. In the example below, <code>prefix</code> is a closed-over-variable.</p>
<pre><code><span class="hljs-keyword">const</span> greet = <span class="hljs-function">() =&gt;</span>  {
    <span class="hljs-keyword">const</span> prefix = <span class="hljs-string">'Mr'</span>
    <span class="hljs-keyword">return</span> <span class="hljs-function">(<span class="hljs-params">name</span>) =&gt;</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${prefix}</span> <span class="hljs-subst">${name}</span>, welcome!`</span>)
    }
}

<span class="hljs-built_in">console</span>.log(greet()(<span class="hljs-string">'Jack'</span>))
</code></pre><p>This section will have a lot of fancy words, so bear with me. We will cover them one by one.</p>
<p>MDN says:</p>
<blockquote>
<p>A function bundled together with its lexical environment forms a closure.</p>
</blockquote>
<p>Okay, what is a lexical environment?</p>
<p>It is essentially the surrounding state – the <strong>local memory</strong> along with the lexical environment of its parent.</p>
<p>Whaaat? 🤯 I know it's a bit of a doozy. Let's understand it with a simple example.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">x</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> a = <span class="hljs-number">7</span>
  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">y</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(a)
  }
  <span class="hljs-keyword">return</span> y
}

<span class="hljs-keyword">var</span> z = x()
<span class="hljs-built_in">console</span>.log(z) <span class="hljs-comment">// [Function: y]</span>
z()
</code></pre>
<p>When x is invoked, y is returned. Now, y is waiting to be executed. Kind of like a loaded gun waiting to be shot! 🔫</p>
<p>So, when we finally invoke z, y is invoked. Now, y has to log <code>a</code> so it first tries to find 🔍 it in the <strong>local memory</strong> but it's not there. It goes to its parent function. It finds <code>a</code> there.</p>
<p>Voila! There you have it - <a target="_blank" href="https://www.freecodecamp.org/news/closures-in-javascript/">this is closure</a>.</p>
<p>Even when functions are returned (in the above case y) they still remember their lexical scope (where it came from)</p>
<p>Totally unrelated quote for kicks 👻:</p>
<blockquote>
<p>They may forget what you said - but they will never forget how you made them feel - Carl W. Buehner</p>
</blockquote>
<p>I swear the rest of the article is legit 🤞 Keep reading.</p>
<h3 id="heading-advantages-of-closures-in-javascript">Advantages of Closures in JavaScript 😎</h3>
<ul>
<li>Currying</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">let</span> add = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">x</span>) </span>{
  <span class="hljs-keyword">return</span> <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">y</span>) </span>{
    <span class="hljs-built_in">console</span>.log(x + y)
  }
}

<span class="hljs-keyword">let</span> addByTwo = add(<span class="hljs-number">2</span>)
addByTwo(<span class="hljs-number">3</span>)
</code></pre>
<ul>
<li>Data Hiding/Encapsulation</li>
</ul>
<p>Suppose you want to create a counter application. Every time you call it, the count increases by 1. But you don't want to expose the variable outside the function. How to do it?</p>
<p>You guessed it – closures!</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Counter</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> count = <span class="hljs-number">0</span>
  <span class="hljs-built_in">this</span>.incrementCount = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    count++
    <span class="hljs-built_in">console</span>.log(count)
  }
}

<span class="hljs-built_in">console</span>.log(count) <span class="hljs-comment">// Error: count is not defined</span>
<span class="hljs-keyword">var</span> adder = <span class="hljs-keyword">new</span> Counter()
adder.incrementCount() <span class="hljs-comment">// 1</span>
</code></pre>
<p>Don't worry about <code>this</code> and <code>new</code>. We have a whole section devoted to them down below.</p>
<h3 id="heading-disadvantages-of-closures-in-javascript">Disadvantages of Closures in JavaScript 😅</h3>
<ul>
<li>Overconsumption of memory or memory leaks can happen.</li>
</ul>
<p>For example, the closed-over-variable will not be garbage collected. This is because, even if the outer function has run, the returned inner function still has a reference to the closed-over-variable.</p>
<p><strong>Note:</strong> Garbage collection basically removes unused variables from the memory automatically.</p>
<h3 id="heading-hoisting-in-javascript">Hoisting in JavaScript 🚩</h3>
<p>This is JavaScript's default behavior of moving declarations to the top of the program.</p>
<ul>
<li><code>var</code> declaration is hoisted up and initialized with <code>undefined</code>.</li>
<li><code>let</code> and <code>const</code> declarations are hoisted up but not initialized.</li>
<li><code>function</code> definitions are also hoisted up and stored as they are.</li>
</ul>
<p>Let's look at an example:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">consoleNum</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-built_in">console</span>.log(num)
  <span class="hljs-keyword">var</span> num = <span class="hljs-number">10</span>
}

consoleNum() <span class="hljs-comment">// undefined</span>

<span class="hljs-comment">// Why no error?</span>

<span class="hljs-comment">// This is how runtime sees this</span>
{
  <span class="hljs-keyword">var</span> num
  <span class="hljs-built_in">console</span>.log(num)
  num = <span class="hljs-number">9</span>
}

<span class="hljs-comment">// If instead of var -&gt; let, it will give an error as let values are not initialized</span>
</code></pre>
<p>Phew! I am done with functions here, but if you want more <a target="_blank" href="https://youtu.be/e-5obm1G_FY">check out this amazing talk by Anjana Vakil</a> on functional programming.</p>
<h2 id="heading-objects-in-javascript">Objects in JavaScript 🔮</h2>
<p>Just like arrays, objects are a way of storing data. We do so with the help of key-value pairs.</p>
<pre><code class="lang-javascript">
    <span class="hljs-keyword">const</span> developer = {
        <span class="hljs-attr">name</span>: <span class="hljs-string">"Raj"</span>,
        <span class="hljs-attr">age</span>: <span class="hljs-number">22</span>
        }
</code></pre>
<p><code>name</code> is the <code>key</code> and <code>Raj</code> is the <code>value</code>. Keys are generally the name of the properties of the object.</p>
<p>We can store all sorts of data like functions inside an object. You can explore more here on the <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">MDN</a>.</p>
<h3 id="heading-what-is-this-in-javascript">What is <code>this</code> in JavaScript?</h3>
<p>Now, working with objects is different in JS than in other popular programming languages like C++. And to understand that properly, we need a good grasp of the <code>this</code> keyword.</p>
<p>Let's try to understand it step-by-step.</p>
<p>In a program, at times, we need a way to point at stuff. Like saying this function right here belongs to this object. <code>this</code> helps us get this context.</p>
<p>You will understand what I am saying better when we look at some examples.</p>
<p>For now, think of <code>this</code> as something which provides context. And remember this important thing: its value depends on how and where it is called.</p>
<p>I know, I know. A lot of <code>this</code> 😬. Let's go over all this slowly.</p>
<p>Start a new program and just log <code>this</code>.</p>
<pre><code class="lang-javascript">
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">this</span>)
</code></pre>
<p>It will point to the window object.</p>
<p>Now, let's take an example with an object:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">myFunc</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">this</span>)     
  }

<span class="hljs-keyword">const</span> obj = {
  <span class="hljs-attr">bool</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">myFunc</span>: myFunc,
}

obj.myFunc()
</code></pre>
<p>Now, <code>this</code> will point to the object. So what's happening here?</p>
<p>In the first example, we had nothing left of the <code>.</code> so it defaulted to the <code>window</code> object. But in this example, we have the object <code>obj</code>.</p>
<p>If you do:</p>
<pre><code class="lang-javascript">
myFunc() <span class="hljs-comment">// window</span>
</code></pre>
<p>We again get the <code>window</code> object. So, we can see that the value of <code>this</code> depends on how and where are we doing the calling.</p>
<p>What we just did above is called <strong>Implicit Binding</strong>. The value of <code>this</code> got bound to the object.</p>
<p>There is another way to use <code>this</code>. <strong>Explicit binding</strong> is when you force a function to use a certain object as its <code>this</code>.</p>
<p>Let's understand why we need explicit binding through an example.</p>
<pre><code class="lang-javascript">
<span class="hljs-keyword">const</span> student_1 =  {
    <span class="hljs-attr">name</span>: <span class="hljs-string">'Randall'</span>,
    <span class="hljs-attr">displayName_1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">displayName</span>(<span class="hljs-params"></span>) </span>{
        <span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">this</span>.name)
    }
}
<span class="hljs-keyword">const</span> student_2 =  {
    <span class="hljs-attr">name</span>: <span class="hljs-string">'Raj'</span>,
    <span class="hljs-attr">displayName_2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">displayName</span>(<span class="hljs-params"></span>) </span>{
        <span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">this</span>.name)
    }
}

student_1.displayName_1()
student_2.displayName_2()
</code></pre>
<p>We are using <code>this</code> properly, but can you see the problem with the above code?</p>
<p>We are repeating code. And one of the principles of good programming is keep your code DRY! (Don't Repeat Yourself)</p>
<p>So, let's get rid of <code>displayName_2</code> and simply do:</p>
<pre><code class="lang-javascript">
student_1.displayName_1.call(student_2) <span class="hljs-comment">// Raj</span>
</code></pre>
<p><code>call</code> forced <code>displayName_1</code> to use the second object as its <code>this</code>.</p>
<p>There are a lot of other ways we can do this.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1622489263380/UwpR9Rscv.png" alt="call-bind-apply.png" width="600" height="400" loading="lazy"></p>
<p>Try to solve the given problem yourself.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> myData = {
  <span class="hljs-attr">name</span>: <span class="hljs-string">'Rajat'</span>,
  <span class="hljs-attr">city</span>: <span class="hljs-string">'Delhi'</span>,
  <span class="hljs-attr">displayStay</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">this</span>.name, <span class="hljs-string">'stays in'</span>, <span class="hljs-built_in">this</span>.city)
  },
}
myData.displayStay()

<span class="hljs-comment">// create an object yourData and try to use displayStay</span>
<span class="hljs-keyword">const</span> yourData = {
 <span class="hljs-attr">name</span>: <span class="hljs-string">'name'</span>,
 <span class="hljs-attr">city</span>: <span class="hljs-string">'city'</span>
}


<span class="hljs-comment">// answer</span>
myData.displayStay.call(yourData)
</code></pre>
<p>Finally, remember that I said that there are differences between arrow and regular functions. </p>
<p>The case of <code>this</code> is one of them.</p>
<p>For an arrow function, the value depends on the lexical scope – that is to say, the outer function where the arrow function is declared.</p>
<p>So, if we make the <code>displayName()</code> from above an arrow function, nothing will work.</p>
<p>Arrow functions basically inherit the parent's context which in the above case is the <code>window</code>.</p>
<h3 id="heading-prototypes-and-prototypal-inheritance-in-javascript">Prototypes and Prototypal Inheritance in JavaScript 👪</h3>
<blockquote>
<p>Whenever we create anything (like an object or function) in JavaScript, the JS Engine automatically attaches that thing with some properties and methods.</p>
</blockquote>
<p>All this comes via <code>prototypes</code>.</p>
<p><code>__proto__</code> is the object where JS is putting it all.</p>
<p>Let's see some examples. Fire up your consoles!</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">let</span> arr = [<span class="hljs-string">'Rajat'</span>, <span class="hljs-string">'Raj'</span>]
<span class="hljs-built_in">console</span>.log(arr.__proto__.forEach)
<span class="hljs-built_in">console</span>.log(arr.__proto__) <span class="hljs-comment">// same as Array.prototype</span>
<span class="hljs-built_in">console</span>.log(arr.__proto__.__proto__) <span class="hljs-comment">// same as Object.prototype</span>
<span class="hljs-built_in">console</span>.log(arr.__proto__.__proto__.__proto__) <span class="hljs-comment">// null</span>
</code></pre>
<p>All this is called a <code>prototype chain</code>.</p>
<p>We can do the same with objects and functions as well.</p>
<p>We will always find <code>Object.prototype</code> behind the scenes. That's why you may have heard that everything in JS is an object. 🤯</p>
<h3 id="heading-what-is-prototypal-inheritance-in-javascript">What is Prototypal Inheritance in JavaScript?</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">let</span> object = {
  <span class="hljs-attr">name</span>: <span class="hljs-string">'Rajat'</span>,
  <span class="hljs-attr">city</span>: <span class="hljs-string">'Delhi'</span>,
  <span class="hljs-attr">getIntro</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${<span class="hljs-built_in">this</span>.name}</span>, <span class="hljs-subst">${<span class="hljs-built_in">this</span>.city}</span>`</span>)
  },
}

<span class="hljs-keyword">let</span> object2 = {
  <span class="hljs-attr">name</span>: <span class="hljs-string">'Aditya'</span>,
}
</code></pre>
<p><strong>Note:</strong> Don't modify prototypes this way. It's just for understanding. <a target="_blank" href="https://javascript.plainenglish.io/how-prototypal-inheritance-works-in-javascript-and-how-to-convert-it-to-class-based-inheritance-632e31e6350d">Here's the right way to do it</a>.</p>
<pre><code class="lang-javascript">object2.__proto__ = object
</code></pre>
<p>By doing this, <code>object2</code> gets access to the object's properties. So, now we can do:</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(object2.city)
</code></pre>
<p>This is <strong>prototypal inheritance</strong>.</p>
<h2 id="heading-asynchronous-javascript">Asynchronous JavaScript ⚡</h2>
<p>So, JS is a <em>single-threaded</em> language. Things happen one at a time. Only after one thing is done can we move to the next thing. </p>
<p>But this creates problems in the real world, especially, when we are working with browsers.</p>
<p>For example, when we need to fetch data from the web - often times we don't know how long will it take to get it. And whether we will be able to get the data successfully. </p>
<p>To help with this, asynchronous JS comes into play. </p>
<p>And the most important concept to understand is the event loop.</p>
<h3 id="heading-event-loops-in-javascript">Event Loops in JavaScript ➰</h3>
<p>Instead of providing a half-baked explanation here, I highly recommend watching this video by Philip Roberts if you haven't already:</p>
<p><a target="_blank" href="https://youtu.be/8aGhZQkoFbQ">Learn all about event loops in JS here</a>.</p>
<h3 id="heading-timers-in-javascript-settimeout-setinterval-clearinterval">Timers in JavaScript – setTimeout, setInterval, clearInterval ⏱️</h3>
<p>I hope you watched the video. It mentioned timers. Let's talk about them more now. These are very frequently asked about in interviews.</p>
<p>The <code>setTimeout()</code> method calls a function or evaluates an expression after a specified number of milliseconds.</p>
<p><code>setInterval()</code> does the same for specified intervals.</p>
<pre><code class="lang-javascript">
<span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Here - I am after 2 seconds'</span>)
}, <span class="hljs-number">2000</span>);

<span class="hljs-keyword">const</span> timer = <span class="hljs-built_in">setInterval</span>(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'I will keep on coming back until you clear me'</span>)
}, <span class="hljs-number">2000</span>);
</code></pre>
<p>You use <code>clearInterval()</code> to stop the timer.</p>
<pre><code><span class="hljs-built_in">clearInterval</span>(timer)
</code></pre><p>Let's go over some questions that use these concepts.</p>
<pre><code class="lang-javascript">  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Hello'</span>)
  <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'lovely'</span>)
  }, <span class="hljs-number">0</span>)
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'reader'</span>)

  <span class="hljs-comment">// output</span>
  Hello
  reader
  lovely
</code></pre>
<p>Here's a slightly trickier one:</p>
<pre><code class="lang-javascript">  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">1</span>; i &lt;= <span class="hljs-number">5</span>; i++) {
    <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
      <span class="hljs-built_in">console</span>.log(i)
    }, i * <span class="hljs-number">1000</span>)
  }

<span class="hljs-comment">// output</span>
<span class="hljs-number">6</span>
<span class="hljs-number">6</span>
<span class="hljs-number">6</span>
<span class="hljs-number">6</span>
<span class="hljs-number">6</span>
</code></pre>
<p>And here's a short explanation of what's going on there: when <code>setTimeout</code> comes again into the picture, the entire loop has run and the value of <code>i</code> has become 6,</p>
<p>Now, let's say we want the outcome to be 1 2 3 4 5 – what do we do?</p>
<p>Instead of <code>var</code> ➡️ use <code>let</code>.</p>
<p>Why this will work?</p>
<p><code>var</code> is globally scoped but <code>let</code> is locally scoped. So for <code>let</code> a new <code>i</code> is created for every iteration.</p>
<h3 id="heading-promises-in-javascript-important">Promises in JavaScript (❗important) 🤝</h3>
<p>Promises are at the heart of Asynchronous JS.</p>
<blockquote>
<p>The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.</p>
</blockquote>
<p>A promise can be in one of these three states:</p>
<ul>
<li>Pending: initial state, neither fulfilled nor rejected</li>
<li>Fulfilled: operation was completed successfully</li>
<li>Rejected: operation failed</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> promise = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve, reject</span>) =&gt;</span> {
  <span class="hljs-keyword">let</span> value = <span class="hljs-literal">true</span>
  <span class="hljs-keyword">if</span> (value) {
    resolve(<span class="hljs-string">'hey value is true'</span>)
  } <span class="hljs-keyword">else</span> {
    reject(<span class="hljs-string">'there was an error, value is false'</span>)
  }
})

promise
  .then(<span class="hljs-function">(<span class="hljs-params">x</span>) =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(x)
  })
  .catch(<span class="hljs-function">(<span class="hljs-params">err</span>) =&gt;</span> <span class="hljs-built_in">console</span>.log(err))
</code></pre>
<p><strong>Note:</strong> <code>resolve</code> and <code>reject</code> are just conventional names. Call it pizza🍕 if you like.</p>
<p>Instead of <code>then/catch</code>, we can also use <code>async/await</code>:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">asyncCall</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> promise
  <span class="hljs-built_in">console</span>.log(result)
}

asyncCall()
</code></pre>
<p>One of the advantages of promises is that they are a much cleaner syntax. Before we had promises, we could easily get stuck in <a target="_blank" href="http://callbackhell.com/">callback hell</a> 🌋</p>
<h2 id="heading-advanced-javascript-concepts-to-know">Advanced JavaScript Concepts to Know</h2>
<h3 id="heading-polyfills-in-javascript">📚 Polyfills in JavaScript</h3>
<blockquote>
<p>A polyfill is a piece of code (usually JavaScript on the Web) used to provide modern functionality on older browsers that do not natively support it. <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Glossary/Polyfill">MDN</a></p>
</blockquote>
<ul>
<li>Let's implement it for <code>map</code>:</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-comment">// this - array</span>
<span class="hljs-comment">// this[i] - current value</span>
<span class="hljs-built_in">Array</span>.prototype.myMap = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">cb</span>) </span>{
  <span class="hljs-keyword">var</span> arr = []
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; <span class="hljs-built_in">this</span>.length; i++) {
    arr.push(cb(<span class="hljs-built_in">this</span>[i], i, <span class="hljs-built_in">this</span>))
  }
  <span class="hljs-keyword">return</span> arr
}

<span class="hljs-keyword">const</span> arr = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]
<span class="hljs-built_in">console</span>.log(arr.myMap(<span class="hljs-function">(<span class="hljs-params">a</span>) =&gt;</span> a * <span class="hljs-number">2</span>)) <span class="hljs-comment">// [2, 4, 6]</span>
</code></pre>
<p>Notice how we use <code>this</code>. Here, we have basically created a new array and are adding values to it.</p>
<h3 id="heading-async-and-defer-in-javascript">Async and defer in JavaScript ✔️</h3>
<p>These concepts are frequently asked about in interviews by big corporations like Amazon, Walmart, and Flipkart. 🏢</p>
<p>To understand <code>async</code> and <code>defer</code>, we need to have an idea of how browsers render a webpage. First, they parse the HTML and CSS. Then DOM trees are created. From these, a render tree is created. Finally, from the render tree - a layout is created and the painting happens.</p>
<p>For a more detailed look, check out <a target="_blank" href="https://youtu.be/SmE4OwHztCc">this video</a>.</p>
<p>Async and defer are <code>boolean</code> attributes which can be loaded along with the script tags. They are useful for loading external scripts into your web page.</p>
<p>Let's understand with the help of pictures.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1621781371965/PciAdUTCL.png" alt="18-async-defer.png" width="600" height="400" loading="lazy">
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1621781403795/VgIYFtP5T.png" alt="19-async-defer.png" width="600" height="400" loading="lazy">
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1621781415787/mJEkxqe_i.png" alt="20-async.png" width="600" height="400" loading="lazy">
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1621781428927/2nUaI8fjr.png" alt="21-defer.png" width="600" height="400" loading="lazy"></p>
<p>If there are multiple scripts which are dependant on each other, use <code>defer</code>. Defer script are executed in the order which they are defined.</p>
<p>If you want to load external script which is not dependant on the execution of any other scripts, use <code>async</code>. </p>
<p><strong>Note:</strong> The async attribute does not guarantee the order of execution of scripts.</p>
<h3 id="heading-debouncing-in-javascript">Debouncing in JavaScript ⛹️‍♂️</h3>
<p>Debouncing is another favorite topic of interviewers.</p>
<p>Let's understand it by creating a search bar.</p>
<p><strong>Demo:</strong> https://codesandbox.io/s/debounce-input-field-o5gml</p>
<p>Create a simple input field in <code>index.html</code> like this:</p>
<pre><code class="lang-javascript">&lt;input type=<span class="hljs-string">'text'</span> id=<span class="hljs-string">'text'</span> /&gt;
</code></pre>
<p>Now, in <code>index.js</code>. Don't forget to add it to <code>index.html</code> first:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> getData = <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {
  <span class="hljs-built_in">console</span>.log(e.target.value)
}
<span class="hljs-keyword">const</span> inputField = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'text'</span>)

<span class="hljs-keyword">const</span> debounce = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">fn, delay</span>) </span>{
  <span class="hljs-keyword">let</span> timer
  <span class="hljs-keyword">return</span> <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">let</span> context = <span class="hljs-built_in">this</span>
    <span class="hljs-built_in">clearTimeout</span>(timer)
    timer = <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
      fn.apply(context, <span class="hljs-built_in">arguments</span>)
    }, delay)
  }
}

inputField.addEventListener(<span class="hljs-string">'keyup'</span>, debounce(getData, <span class="hljs-number">300</span>))
</code></pre>
<p>First, we have selected the input and added an <code>event listener</code> to it. Then we created a debounce function which takes a callback function and delay.</p>
<p>Now, inside the debounce function we create a timer using <code>setTimeout</code>. Now, this timer's job is to make sure that the next call for <code>getData</code> only happens after 300 ms. This is what debouncing is.</p>
<p>Also, we use <code>clearTimeout</code> to remove it. Don't want too many of them hanging out there taking up memory space!</p>
<p>Phew! Lots of theory. Let's do a fun challenge. You must have seen the countdown before a game starts (it goes like 10, 9, 8, .... with some delay in between). Try to write a program for it.</p>
<p>Here's how you'd do it:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">let</span> count = <span class="hljs-number">10</span>

<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; <span class="hljs-number">10</span>; i++) {
  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">timer</span>(<span class="hljs-params">i</span>) </span>{
    <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
      <span class="hljs-built_in">console</span>.log(count)
      count--
    }, i * <span class="hljs-number">500</span>)
  }
  timer(i)
}
</code></pre>
<p>Were you able to solve it? Did you do it differently? Let me know your solution.</p>
<h3 id="heading-throttling-in-javascript">Throttling in JavaScript 🛑</h3>
<p>Let's look at an example again. Suppose that on every window resize event we call an expensive function. Now, we want it such that the expensive function will only be executed once in the given time interval. This is what throttling is.</p>
<p>Create an <code>index.html</code> and an <code>index.js</code> with the following code:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> expensive = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'expensive'</span>)
}

<span class="hljs-keyword">const</span> throttle = <span class="hljs-function">(<span class="hljs-params">fn, limit</span>) =&gt;</span> {
  <span class="hljs-keyword">let</span> context = <span class="hljs-built_in">this</span>
  <span class="hljs-keyword">let</span> flag = <span class="hljs-literal">true</span>
  <span class="hljs-keyword">return</span> <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">if</span> (flag) {
      fn.apply(context, <span class="hljs-built_in">arguments</span>)
      flag = <span class="hljs-literal">false</span>
    }
    <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
      flag = <span class="hljs-literal">true</span>
    }, limit)
  }
}
<span class="hljs-keyword">const</span> func = throttle(expensive, <span class="hljs-number">2000</span>)
<span class="hljs-built_in">window</span>.addEventListener(<span class="hljs-string">'resize'</span>, func)
</code></pre>
<p>Almost the same as debouncing. The key difference is the <code>flag</code> variable. Only, when it's true we are invoking the callback function. And it is set to <code>true</code> inside the <code>setTimeout</code>. So the value is <code>true</code> only after the desired time limit.</p>
<h3 id="heading-so-whats-the-difference-between-debounce-and-throttling">So, what's the difference between debounce and throttling❓</h3>
<p>Let's take the search bar 🔍 example from above. When we are debouncing the input field, we are saying to only fetch the data when the difference between two <code>keyup</code> events is at least 300 ms.</p>
<p>In the case of throttling, we make a function call only after a certain period of time. </p>
<p>Suppose that you are searching for an encyclopedia in the search bar. The first call is made on <code>e</code> and it took us 300 ms to reach <code>p</code>. The next call will be made then only. All the events in between will be ignored.</p>
<p>So, to summarize, debouncing is when the difference between two <code>keyup</code> events is 300 ms. And throttling is when the difference between two function calls is 300 ms. Basically, the function is called after a certain interval of time.</p>
<h2 id="heading-storage-in-javascript">Storage in JavaScript 💾</h2>
<p>Finally, a small but important topic to wrap things up.</p>
<p><strong>localStorage:</strong> Data persists even after closing your session</p>
<p><strong>sessionStorage:</strong> You lose your data when your session is over, like when you close the browser on the tab.</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// save</span>
<span class="hljs-built_in">localStorage</span>.setItem(<span class="hljs-string">'key'</span>, <span class="hljs-string">'value'</span>)
<span class="hljs-comment">// get saved data</span>
<span class="hljs-keyword">let</span> data = <span class="hljs-built_in">localStorage</span>.getItem(<span class="hljs-string">'key'</span>)
<span class="hljs-comment">// remove saved data</span>
<span class="hljs-built_in">localStorage</span>.removeItem(<span class="hljs-string">'key'</span>)
<span class="hljs-comment">// Same for sessionStorage</span>
</code></pre>
<p>And we are done! 🏁 I hope you feel more confident about your next JS interview now. I wish you all the best.</p>
<p>If you have any queries / suggestions / feedback, you can reach me on Twitter: <a target="_blank" href="https://twitter.com/rajatetc">https://twitter.com/rajatetc</a>.</p>
<h2 id="heading-main-references">🗃️ Main References</h2>
<ul>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/">MDN Docs</a></li>
<li><a target="_blank" href="https://www.youtube.com/channel/UC3N9i_KvKZYP4F84FPIzgPQ">Akshay Saini</a></li>
<li><a target="_blank" href="https://www.youtube.com/channel/UCMZFwxv5l-XtKi693qMJptA">Coding Addict</a></li>
<li><a target="_blank" href="https://www.instagram.com/javascript_interviews/">Javascript_Interviews</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Coding Interview Backtracking Problems Crash Course – The Only One You'll Ever Need ]]>
                </title>
                <description>
                    <![CDATA[ Whether you are new to coding interviews or are already familiar with the concept of backtracking algorithms, this is the crash course for you. In it, we will learn about an all-purpose coding template for solving backtracking problems and apply it t... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/coding-interview-backtracking-problems-crash-course/</link>
                <guid isPermaLink="false">66d4601355db48792eed3f6b</guid>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ interview questions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Job Interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ leetcode ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Lynn Zheng ]]>
                </dc:creator>
                <pubDate>Tue, 29 Jun 2021 20:00:32 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/06/1080P-Thumbnails-1-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Whether you are new to coding interviews or are already familiar with the concept of <strong>backtracking</strong> algorithms, this is the crash course for you.</p>
<p>In it, we will learn about <strong>an all-purpose coding template</strong> for solving backtracking problems and apply it to <strong>two LeetCode hard problems</strong>. Ready to crunch your next coding interview? Let's go!</p>
<p>If you just want to dive right in, <a target="_blank" href="https://www.youtube.com/watch?v=H2gnD7Ixeao">you can find the course here</a> (and linked at the bottom of this article). If you want a little more info, read on. :)</p>
<h2 id="heading-who-is-the-course-for-and-what-is-the-backtracking-algorithm">Who is the Course for and What is the Backtracking Algorithm?</h2>
<p>This course is suitable for anyone who is preparing for coding interviews, especially those who are looking to hone their skills in solving <strong>backtracking</strong> problems.</p>
<p>Backtracking is a common category for questions in coding interviews. The algorithm for solving those problems usually involves <strong>recursion</strong> and <strong>building incrementally on previous states</strong> to arrive at the ultimate valid solution.</p>
<p>Backtracking is a favorite topic among top tech companies like Google, Microsoft, and Facebook, precisely because it requires robust reasoning and coding competence to nail those questions.</p>
<p>However, because of its recursive nature and complex problem definition, backtracking problems are usually a major source of confusion among devs who are preparing for coding interviews.</p>
<p>To address this confusion, this crash course aims to arm with you a concise, 20-line template that you can apply to the majority of backtracking problems.</p>
<h2 id="heading-course-outline">Course Outline</h2>
<p>This course runs for a total of 40 minutes and the structure is as follows:</p>
<ul>
<li><p>An 8-minute introduction to <a target="_blank" href="https://gist.github.com/RuolinZheng08/cdd880ee748e27ed28e0be3916f56fa6">the template</a></p>
</li>
<li><p>A 15-minute hands-on code-along session for <a target="_blank" href="https://leetcode.com/problems/n-queens/">LeetCode Question 51. N-Queens</a></p>
</li>
<li><p>A 15-minute hands-on code-along session for <a target="_blank" href="https://leetcode.com/problems/sudoku-solver/">LeetCode Question 37. Sudoku Solver</a></p>
</li>
</ul>
<h2 id="heading-the-all-purpose-template">The All-Purpose Template</h2>
<p>For your convenience, I've copied the template over. This is exactly the same template that I use for my coding interviews, or when I'm developing algorithms for my indie games. I even used it once in my research on a non-convex optimization problem.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_valid_state</span>(<span class="hljs-params">state</span>):</span>
    <span class="hljs-comment"># check if it is a valid solution</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">True</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_candidates</span>(<span class="hljs-params">state</span>):</span>
    <span class="hljs-keyword">return</span> []

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">search</span>(<span class="hljs-params">state, solutions</span>):</span>
    <span class="hljs-keyword">if</span> is_valid_state(state):
        solutions.append(state.copy())
        <span class="hljs-comment"># return</span>

    <span class="hljs-keyword">for</span> candidate <span class="hljs-keyword">in</span> get_candidates(state):
        state.add(candidate)
        search(state, solutions)
        state.remove(candidate)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">solve</span>():</span>
    solutions = []
    state = set()
    search(state, solutions)
    <span class="hljs-keyword">return</span> solutions
</code></pre>
<p>The first three are all helper functions, and the last and most important one, <code>solve</code>, is essentially the one that a LeetCode problem is asking you to write.</p>
<h2 id="heading-solving-leetcode-problems-hands-on">Solving LeetCode Problems Hands-On</h2>
<p>We will next apply this template to solving two LeetCode hard problems: <a target="_blank" href="https://leetcode.com/problems/n-queens/">LeetCode Question 51. N-Queens</a> and <a target="_blank" href="https://leetcode.com/problems/sudoku-solver/">LeetCode Question 37. Sudoku Solver</a>.</p>
<p>To illustrate the flexibility of the template, see below for how we solve the N-Queens problem by doing nothing fancy other than adapting the four functions (renaming <code>solve</code> to <code>solveNQueens</code>). The complete code for either problem is available <a target="_blank" href="https://gist.github.com/RuolinZheng08/cdd880ee748e27ed28e0be3916f56fa6">in my GitHub gist</a>.</p>
<p>Watch <a target="_blank" href="https://youtu.be/H2gnD7Ixeao">the video course</a> to follow along my analysis and adaptation of the template.</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Solution</span>:</span>
    <span class="hljs-comment"># solveNQueens is essentially the solve function</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">solveNQueens</span>(<span class="hljs-params">self, n: int</span>) -&gt; List[List[str]]:</span>
        solutions = []
        state = []
        self.search(state, solutions, n)
        <span class="hljs-keyword">return</span> solutions

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_valid_state</span>(<span class="hljs-params">self, state, n</span>):</span>
        <span class="hljs-comment"># check if it is a valid solution</span>
        <span class="hljs-keyword">return</span> len(state) == n

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_candidates</span>(<span class="hljs-params">self, state, n</span>):</span>
        <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> state:
            <span class="hljs-keyword">return</span> range(n)

        <span class="hljs-comment"># find the next position in the state to populate</span>
        position = len(state)
        candidates = set(range(n))
        <span class="hljs-comment"># prune down candidates that place the queen into attacks</span>
        <span class="hljs-keyword">for</span> row, col <span class="hljs-keyword">in</span> enumerate(state):
            <span class="hljs-comment"># discard the column index if it's occupied by a queen</span>
            candidates.discard(col)
            dist = position - row
            <span class="hljs-comment"># discard diagonals</span>
            candidates.discard(col + dist)
            candidates.discard(col - dist)
        <span class="hljs-keyword">return</span> candidates

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">search</span>(<span class="hljs-params">self, state, solutions, n</span>):</span>
        <span class="hljs-keyword">if</span> self.is_valid_state(state, n):
            state_string = self.state_to_string(state, n)
            solutions.append(state_string)
            <span class="hljs-keyword">return</span>

        <span class="hljs-keyword">for</span> candidate <span class="hljs-keyword">in</span> self.get_candidates(state, n):
            <span class="hljs-comment"># recurse</span>
            state.append(candidate)
            self.search(state, solutions, n)
            state.pop()
</code></pre>
<p>Check out the video course here:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/H2gnD7Ixeao" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<p>You can access the template as well as the solutions to the two LeetCode problems (<strong>N-Queens</strong> and <strong>Sudoku Solver</strong>) in my GitHub gist:</p>
<div class="gist-block embed-wrapper" data-gist-show-loading="false" data-id="cdd880ee748e27ed28e0be3916f56fa6">
        <script src="https://gist.github.com/RuolinZheng08/cdd880ee748e27ed28e0be3916f56fa6.js"></script></div><p> </p>
<h2 id="heading-final-thoughts">Final Thoughts</h2>
<p>Remember that practice makes perfect, so do try applying this template to <a target="_blank" href="https://leetcode.com/tag/backtracking/">more backtracking problems on LeetCode.</a> Best of luck crunching your next coding interview!</p>
<p>For more content like this, check out my YouTube channel:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/undefined" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ System Design Interview Tutorial – The Beginner's Guide to System Design ]]>
                </title>
                <description>
                    <![CDATA[ By Charles M. System Design is an important topic to understand if you want to advance further in your career as a software engineer. Even if you are just beginning your coding journey, it's a good idea to get a head start on learning about system de... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/system-design-interview-practice-tutorial/</link>
                <guid isPermaLink="false">66d45ddb8812486a37369c75</guid>
                
                    <category>
                        <![CDATA[ beginners guide ]]>
                    </category>
                
                    <category>
                        <![CDATA[ distributed systems ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Job Interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Microservices ]]>
                    </category>
                
                    <category>
                        <![CDATA[ System Architecture ]]>
                    </category>
                
                    <category>
                        <![CDATA[ System Design ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 14 Jun 2021 22:46:31 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/06/youtube-system-design-thumbnail.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Charles M.</p>
<p>System Design is an important topic to understand if you want to advance further in your career as a software engineer. Even if you are just beginning your coding journey, it's a good idea to get a head start on learning about system design. </p>
<p>Early in your career you will mostly just be tested on your coding ability. In higher level interviews, however, there will often be a greater focus on testing your ability and experience at designing applications.</p>
<p>The biggest struggle engineers have with system design interviews is that they are more open-ended and there isn't any single correct answer. This lack of structure can be intimidating, so my goal with this article is to give you a roadmap for navigating these types of interviews with confidence.</p>
<p>What this article will cover:</p>
<ul>
<li>What is a system design interview and why they are used</li>
<li>The main stages of a system design interview</li>
<li>Example interview problem – Design YouTube</li>
</ul>
<h2 id="heading-video-tutorial">Video Tutorial</h2>
<p>You can also watch this tutorial on YouTube if you like:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/YEwKnGARDZI" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p>And I've created a playlist of videos on specific topics related to system design and web architecture:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/undefined" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h2 id="heading-system-design-interview-overview">System Design Interview Overview</h2>
<p>At first glance it seems silly to ask somebody to design a huge app like Twitter or YouTube in 45-60 minutes. These apps were designed over a period of years by hundreds of engineers working together, so it's clearly an impossible task to do in a short interview.</p>
<p>There are two main reasons why companies use these types of interviews. The first is, of course, to test your knowledge about the technologies being discussed. They want you to go deep enough to make sure you aren't just throwing buzzwords around without understanding how things actually work. </p>
<p>The second reason might be more important, though. The system design interview is a way to simulate a realistic scenario where you are working together with the interviewer to determine the best design decision. </p>
<p>Getting the perfect answer isn't necessarily the most important thing here – it's some of the other things you can show, like:</p>
<ul>
<li>How do you handle being challenged? Do you get defensive or take feedback with a positive attitude? Are you stubborn or narrow-minded?</li>
<li>Do you show knowledge of the various tradeoffs certain design decisions involve? There's a big difference between blindly making a decision and not realizing the consequences, and knowing the pros/cons and accepting the tradeoffs.</li>
<li>Are you able to effectively communicate and if necessary explain complex technical concepts in an easy to understand way?</li>
<li>Are you candidate somebody the interviewer would want to work with long term? Even if somebody is a genius, if they are miserable to work with they might not be a good hire.</li>
</ul>
<h2 id="heading-stages-of-a-system-design-interview">Stages of a System Design Interview</h2>
<p>In this section you'll learn a general framework for structuring how to handle a problem during a system design interview.</p>
<h3 id="heading-clarify-the-problem-and-establish-design-scope">Clarify the problem and establish design scope</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-106.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The first thing you'll want to do after your interviewer gives you the problem is to take a few minutes to ask some clarifying questions and figure out what exactly they are looking for. </p>
<p>The worst thing you could do here is just start off in the completely wrong direction because you didn't take the time to ask a few questions. You have a limited amount of time during the interview, so you want to make sure you focus on what's important. </p>
<p>Here are some examples of questions you might ask:</p>
<h4 id="heading-what-are-the-use-cases-features-of-the-app">What are the use cases / features of the app?</h4>
<p>In this article we will be using YouTube as an example. There are hundreds of different features you could design like ad delivery, authentication, recommendation algorithms, comments, video upload, video processing, and many others. </p>
<p>During an interview you only have time to cover a few of those, so make sure to ask the interviewer questions to figure out what they want you to focus on designing.</p>
<h4 id="heading-how-many-users-are-expected-what-is-the-likely-traffic-volume">How many users are expected / what is the likely traffic volume?</h4>
<p>The complexity of the system will depend on the amount of traffic it needs to handle, so make sure to gather this information. </p>
<p>You don't want to over-engineer things if the traffic is relatively low and you also don't want to get stuck with an app that can't scale because you didn't design it properly. </p>
<p>Ask questions like how many users the app will have, the average amount of data per request, how long data needs to be stored, and how reliable and available does the system need to be?</p>
<p>This step is going to help you beyond just getting more information to work with. You're also showing the interviewer that you understand how to gather information about a vague problem. </p>
<h3 id="heading-determine-rough-capacity-estimates">Determine Rough Capacity Estimates</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-107.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Using the information you gathered during the first step, you can begin to make some rough estimates and generalizations for things like storage and bandwidth requirements.</p>
<p>This process will involve some basic math like multiplying the number of users by the average request size and the amount of requests each user is expected to make daily. </p>
<h3 id="heading-create-a-high-level-design">Create a High Level Design</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-108.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Here you want to create a rough architecture for the system. Draw out things like load balancers, web servers, app servers, task queues, database, caching, file storage, and so on. You should include all the core components you need to create the system. </p>
<p>Make sure to communicate with the interviewer during this stage and check to ensure that you aren't missing anything. While they probably won't tell you directly, they will give you a nudge in the right direction if you forgot about some crucial feature.</p>
<h3 id="heading-api-design">API Design</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-114.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>This part is almost cheating because you are using the structure of the interview to your advantage to confirm that you are on the right path. </p>
<p>The interviewer is never going to deliberately lead you down the wrong path, so once you've created your high level design you can start sketching out some rough API endpoints for each component. </p>
<p>For the YouTube example they might look something like this, depending on which features you are building:</p>
<ul>
<li>uploadVideo (userID, video, description, title)</li>
<li>comment (userID, videoID, comment)</li>
<li>viewVideo (videoID)</li>
<li>videoSearch (query)</li>
</ul>
<p>In some cases you might not need to drill down to this level. If the interview question is very high level like "design Youtube", you can probably skip this part. On the other hand if you get a more focused question like "design YouTube's comment system", it would make sense to go more in depth.</p>
<h3 id="heading-create-a-data-schema">Create a Data Schema</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-113.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>At this point you should have a good idea of all the requirements and data needed for the application to work, so now you can plan out how your data is structured. </p>
<p>Depending on what you are building and the requirements, you'll need to weigh the costs and benefits of things like using a relational vs non-relational database. When modeling your data you'll also want to account for things like potential data partitioning and replication.</p>
<h3 id="heading-take-a-detailed-look-at-the-components">Take a Detailed Look at the Components</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-112.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>What happens during this section will mainly depend on the feedback of the interviewer. They will probably pick out a few specific components to focus on and ask why you made certain decisions. </p>
<p>The most important part here isn't necessarily being 100% right. Instead, it's to show that you didn't just blindly make decisions and understand exactly what tradeoffs you were making. </p>
<p>You should be able to propose alternate design decisions that could have been used and explain why you didn't use them.</p>
<h2 id="heading-how-to-design-youtube">How to Design YouTube</h2>
<p>Now that you have a general idea of how a system design interview works and a framework for handling a system design problem, I'm going to show you how to put it all into practice using YouTube as an example.</p>
<h3 id="heading-step-1-define-problem-scope-and-requirements">Step 1 – Define Problem Scope and Requirements</h3>
<p>This will be a high level problem where we implement a few of YouTube's major features without diving too in-depth on any of them. The features to focus on will be:</p>
<ul>
<li>Users can upload videos</li>
<li>Users can view videos</li>
<li>Users can comment on videos</li>
</ul>
<h3 id="heading-step-2-determine-capacity-estimates">Step 2 – Determine Capacity estimates</h3>
<p>The two biggest capacity factors in an app handling large amounts of video like YouTube will be storing all that content and bandwidth requirements to deliver the content to users. In this section you'll learn how to make rough estimates for capacity requirements. </p>
<p>The main focus here is not on being highly accurate, but showing a logical thought process for calculating these numbers based on the information available to you.</p>
<p>In an interview you would be given the data, but in this case I'm using two key pieces of data that YouTube has made public:</p>
<ul>
<li><strong>YouTube creators upload 500 hours of video every minute</strong></li>
<li><strong>YouTube users watch 1 billion hours of video per day</strong></li>
</ul>
<p>You can use these numbers to calculate storage and bandwidth requirements with a few assumptions.</p>
<h4 id="heading-bandwidth-calculation">Bandwidth Calculation</h4>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-92.png" alt="Image" width="600" height="400" loading="lazy">
<em>Daily bandwidth calculation</em></p>
<p>To calculate an estimate for bandwidth, we start with the amount of video watched daily. The key assumption here is how much bandwidth is used per hour watched, as this would depend on the quality of video most users choose to watch. </p>
<p>The 3 Gigabyte estimate is based on a rough percentage of users watching in standard definition and others choosing HD or 4K, which consume much more bandwidth per hour watched.</p>
<p>The math here is fairly simple: multiply 1 billion hours by the average bandwidth of an hour of video, then divide that by 1000 to convert to terabytes, then divide by 1000 again to get to Petabytes. The final bandwidth estimate is <strong>3,000 PB</strong> used daily.</p>
<h4 id="heading-storage-calculation">Storage Calculation</h4>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-91.png" alt="Image" width="600" height="400" loading="lazy">
<em>Step by step calculations for storage</em></p>
<p>Based on a few assumptions we can calculate that YouTube will need to store around <strong>2.16</strong> <strong>Petabytes</strong> of new video every day. Here's how we get that number:</p>
<ul>
<li>Convert 500 hours to 30,000 minutes of video uploaded per minute</li>
<li>Each minute of HD video is roughly 50 Megabytes due to having copies of each video in multiple formats. We multiply that by 30,000 minutes and then divide by 1000 to convert to Gigabytes.</li>
<li>We then take the 1,500GB uploaded per minute and multiply by 60 then 24 to calculate the daily amount of video uploaded. We divide by 1000 again to convert Gigabytes to Terabytes</li>
<li>Our final total is 2,160 Terabytes uploaded daily or 2.16 Petabytes</li>
</ul>
<h3 id="heading-step-3-database-design">Step 3 – Database Design</h3>
<p>For our database we will use a standard relational database like MySQL. The schema will look something like this: </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-93.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>This design is very simple but has the essentials that you'd need for a basic implementation. It would be a good idea to do some research into the differences between relational and non-relational databases so you understand what kind of situations each excel at and when to use them. </p>
<p>For certain apps with different requirements a NoSQL database might make sense. Often large systems will have many different services that use different types of databases depending on their needs.</p>
<h3 id="heading-step-4-high-level-design">Step 4 – High Level Design</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/image-95.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>That's a pretty complex diagram, so let me break down what's happening:</p>
<ul>
<li><strong>Client</strong> – This could be a user on a mobile app or their computer trying to upload a video, make a comment, or watch a video</li>
<li><strong>CDN</strong> – A content distribution network is used to reduce latency and improve reliability when it comes to delivering static content like videos or images. A CDN works by storing content in data centers all around the world so that the content is closer to users. This results in reduced latency because requests travel a shorter distance. There's also an added benefit of content being stored in multiple locations so even if one location can't serve traffic for some reason, another location can.</li>
<li><strong>Load Balancers</strong> – A load balancer accepts requests and routes them to servers depending on a number of factors. At YouTube's scale, a single server can't handle all the traffic and you want replication to prevent a single point of failure. The load balancer can check the status of servers and verify they can handle traffic or choose another server that can handle the request.</li>
<li><strong>Services</strong> – You can think of this as the app layer of the system. Instead of using a single monolith to handle traffic, we'll use several microservices to handle specific tasks. The second box for each of these services in the diagram represents multiple servers running for each of them to increase reliability. If one replica of the service goes down, there's always another to step in and handle traffic.</li>
<li><strong>Data Stores</strong> – When using microservices it is generally best practice for each microservice to own its own data. If one service needs data from another they can access it through an API.</li>
<li><strong>Video Upload Process</strong> – Handling the video uploads will involve multiple steps, as trying to handle it synchronously with the app server would be fragile and reduce performance. I'll cover this more in depth in the next section</li>
</ul>
<p>I don't want to go too in-depth on these individual components because I could write entire articles on any of them if I wanted to explain them fully. </p>
<p>If you are interested in a more detailed explanation you can check out the system design playlist I linked to above which has videos covering most of these concepts. </p>
<h3 id="heading-step-5-go-over-specific-components-and-details">Step 5 – Go Over Specific Components and Details</h3>
<p>At this stage you have a working design. Now let's look at some of the specific components in detail.</p>
<h4 id="heading-video-upload">Video Upload</h4>
<p>Video content is the lifeblood of YouTube, and it doesn't exist without it. This means that making it quick and easy for users to upload videos is probably the most important feature. </p>
<p>Imagine uploading a multi-gigabyte video to YouTube and then seeing the upload fail after 30 minutes when it's 95% done. To prevent this you'll want to support the ability for resuming uploads if the client's connection is lost temporarily. The uploaded video can then be stored with a distributed file system like HDFS. </p>
<p>Once the upload is complete there's still a lot more to do before the video is ready for users to access. The video needs to be encoded into multiple different quality formats, you need to generate thumbnails, and push copies of the video to the global CDN. </p>
<p>Again, at any stage one of these processes could fail. To prevent this you'll have a task queue to manage this process and retry the processing attempt if it fails at any stage. </p>
<h4 id="heading-database-scaling">Database Scaling</h4>
<p>The database is often the bottleneck of an application. You will probably be tested on whether you understand some of the fundamental concepts around database scaling. This could include caching to handle read requests, sharding, and replication. </p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Hopefully this article has given you a better understanding of what to expect during a system design interview. </p>
<p>This article mainly focused on the structure of the interview itself rather than the concepts you need to understand to answer the questions given during the interview. </p>
<p>Two great resources for beginning to learn about that are:</p>
<p>A great article posted here on Free Code Camp News: <a target="_blank" href="https://www.freecodecamp.org/news/systems-design-for-interviews/">https://www.freecodecamp.org/news/systems-design-for-interviews/</a></p>
<p>The system design primer repo on GitHub: <a target="_blank" href="https://github.com/donnemartin/system-design-primer">https://github.com/donnemartin/system-design-primer</a></p>
<p>Both cover just about every major concept you need to know for your system design interview and should put you in a great position for success.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Ace Your Coding Interview – Advice from a Senior Software Engineer ]]>
                </title>
                <description>
                    <![CDATA[ By Daniel Chae Technical interviews are one of the most stressful parts of landing a job in tech.  You don't know what questions the interviewer is going to ask. What if you have no idea how to solve the problem in front of you? What if you freeze up... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-acing-your-coding-interview-advice-from-senior-software-engineer/</link>
                <guid isPermaLink="false">66d45e04aad1510d0766b5f9</guid>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ interview questions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ self-improvement  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 10 May 2021 17:04:31 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/05/kaleidico-3V8xo5Gbusk-unsplash--2-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Daniel Chae</p>
<p>Technical interviews are one of the most stressful parts of landing a job in tech. </p>
<p>You don't know what questions the interviewer is going to ask. What if you have no idea how to solve the problem in front of you? What if you freeze up and look like you don't know what you're doing?</p>
<p>Many aspiring programmers work themselves up into a frenzy as they try to memorize every coding interview question. You and I both know this approach is unsustainable. I'm here to tell you there's an easier way. </p>
<p>I recently sat down with my friend Michelle, who's a senior software engineer at Stitch Fix (a recently IPO'd company). She shared the kinds of qualities she looks for in developers that she interviews. </p>
<p>Honestly, the qualities might surprise you. I promise they don't include memorizing coding interview questions and solutions.</p>
<p>The rest of this article will unpack the qualities Michelle looks for in developer candidates. I'll translate each of these qualities into key interview behaviors. Then I'll tell you how you can implement them in your own interviews. Let's get started.</p>
<h2 id="heading-qualities-you-should-have-going-into-the-coding-interview">Qualities you should have going into the coding interview</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/rachel-mcdermott-0fN7Fxv1eWA-unsplash.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>When I sat down with Michelle, a part of me imagined I was getting a secret code to cracking the coding interview. I thought I'd hear the ultimate algorithm to solving every problem out there. </p>
<p>While we know a universal algorithm doesn't exist, she did share something even better: how to create a mental a framework for interviewing.</p>
<p>Success is not about memorizing every problem and solution. Rather, it's about learning how to solve problems. </p>
<p>As a developer, there won't be a cookie-cutter LeetCode type of answer. This is where mental frameworks are incredibly helpful. They create just enough problem solving certainty to overcome a seemingly ambiguous problem. </p>
<p>Here are Michelle's key components to building a killer mindset framework for your coding interview.</p>
<h2 id="heading-be-curious">Be curious</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/ayo-ogunseinde-sibVwORYqs0-unsplash.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>One of Michelle's biggest tips for developer candidates is to be curious. Clarify the problem and ask questions. Share any thoughts you have on the problem you're facing. Interviewers aren't just looking for the right solution. They want to see how you think. </p>
<p>The best way you can show how you think is by asking questions. Let's say an interviewer asks you to check if a string contains any digits. You should clarify the question in your own words, something like:</p>
<p>"So I need to find a way to verify if a set of characters contains any numbers?"</p>
<p>When you say this you're giving interviewers insight into your logic. You're also showing them you're interested in the problem. </p>
<p>And don't be afraid to ask follow-up questions. Using the same example above, here are a few questions you can ask:</p>
<p>"Do the numbers I'm looking for contain decimals?"</p>
<p>"Do I need to sort the characters in any way before checking them?" </p>
<h2 id="heading-be-open-to-suggestions">Be open to suggestions</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/christina-wocintechchat-com-IxmHiUC-yOw-unsplash.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>One thing that is easy to forget is that interviewers want you to succeed. Most interviewers want to provide real-time feedback and suggestions to candidates. But candidates often take a non-verbal, siloed approach to the coding interview. </p>
<p>One way you can be more open to suggestions is by engaging your interviewer. Verbalize your logic and take them along your problem solving journey. </p>
<p>We'll use the same problem as above. Here are a few ways you can verbalize your logic from the get-go:</p>
<p>"So I'll need to establish a way to separate characters from numbers, right?"</p>
<p>"I'm thinking about iterating through the set of characters from end to end."</p>
<p>"I want a programmatic way to iterate through characters, but stop at numbers."</p>
<p>The more insight you can provide, the more your interviewer will feel inclined to help. </p>
<h2 id="heading-work-collaboratively">Work collaboratively</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/airfocus-v89zhr0iBFY-unsplash.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>This goes hand in hand with the above. The idea that a developer works siloed and alone is a myth. You have version control and project management tools that require collaboration. </p>
<p>You should verbalize your approach, ask great questions, and loop your interviewer in. You'll arrive at the solution much more quickly. But you'll also show your interviewer you can effectively collaborate with other developers. </p>
<p>Here are a few ways you can loop your interviewer in:</p>
<p>"Would a for loop be too simple/complex for this solution?"</p>
<p>"How important is it to establish if there are floats or not?"</p>
<p>"Is there any type of solution you have in mind?"</p>
<h2 id="heading-be-willing-to-just-go-for-it">Be willing to just go for it</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/dayne-topkin-XQWtAFOO7zc-unsplash.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Finally, Michelle suggested that developer candidates should just go for it. Meaning, go for the success you want to see. </p>
<p>One of the most common occurrences for candidates is that they freeze up. While this is understandable, no one wins in this situation. You can't show how incredible you are and the interviewer can't help you. Here's what Michelle said to "just go for it":</p>
<blockquote>
<p>Even if you have to pseudocode your implementation, that’s better than being too nervous to try. Putting something on the board/coderpad will invite discussion, a chance to share your thoughts, and an opportunity to learn.   </p>
<p>Don’t be afraid to fail! It just means you’re one step closer to succeeding. :)</p>
</blockquote>
<p>"Just go for it" can mean a lot of things. That said, here are a few examples of what that can look like:</p>
<ul>
<li>Write pseudocode on the whiteboard, paper, or coderpad</li>
<li>Note exactly where you are stuck in your logic</li>
<li>Verbalize the solution you wish you could come up with</li>
</ul>
<h2 id="heading-use-the-mindset-framework-to-ace-your-coding-interview">Use the Mindset Framework to Ace Your Coding Interview!</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/denys-nevozhai-z0nVqfrOqWA-unsplash.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Coding interviews can be scary and there's always the fear that you'll freeze up. Part of this fear stems from not knowing which questions will show up. </p>
<p>The great thing is that you no longer have to memorize coding questions and solutions. Instead, build a mindset framework with the key interview behaviors you read about today. </p>
<p>You want to be curious and open to suggestions. You should work in collaboration with your interviewer. Be willing to go for the success you want to see. Happy interviewing! </p>
<p>If you want to see more of this type of content, subscribe to my newsletter at <a target="_blank" href="https://coursetohire.com/">Course to Hire</a>. I'll help you learn how to code and break into tech. Feel free to add me on <a target="_blank" href="https://www.linkedin.com/in/daniel-chae11/">LinkedIn</a> as well.</p>
<p>P.S. – if you're interested in connecting with Michelle, ping me on Course to Hire or LinkedIn and I can make the intro.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Solve Coding Problems with a Simple Four Step Method ]]>
                </title>
                <description>
                    <![CDATA[ By Madison Kanna I had fifteen minutes left, and I knew I was going to fail. I had spent two months studying for my first technical interview.  I thought I was prepared, but as the interview came to a close, it hit me: I had no idea how to ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-solve-coding-problems/</link>
                <guid isPermaLink="false">66d8518c62a291dea89878dc</guid>
                
                    <category>
                        <![CDATA[ coding challenge ]]>
                    </category>
                
                    <category>
                        <![CDATA[ coding interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Problem Solving ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 04 Feb 2021 18:33:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/01/iStock-527234840.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Madison Kanna</p>
<p>I had fifteen minutes left, and I knew I was going to fail.</p>
<p>I had spent two months studying for my first technical interview. </p>
<p>I thought I was prepared, but as the interview came to a close, it hit me: I had no idea how to solve coding problems. </p>
<p>Of all the tutorials I had taken when I was learning to code, not one of them had included an approach to solving coding problems. </p>
<p>I had to find a method for problem-solving—my career as a developer depended on it.</p>
<p>I immediately began researching methods. And I found one. In fact, what I uncovered was an invaluable strategy. It was a time-tested four-step method that was somehow under the radar in the developer ecosystem.</p>
<p>In this article, I’ll go over this four-step problem-solving method that you can use to start confidently solving coding problems. </p>
<p>Solving coding problems is not only part of the developer job interview process—it’s what a developer does all day. After all, <em>writing code is problem-solving.</em></p>
<h2 id="heading-a-method-for-solving-problems">A method for solving problems</h2>
<p>This method is from the book <em>How to Solve It</em> by George Pólya. It originally came out in 1945 and has sold over one million copies. </p>
<p>His problem-solving method has been used and taught by many programmers, from computer science professors (see Udacity’s Intro to CS course taught by professor David Evans) to modern web development teachers like Colt Steele.</p>
<p>Let’s walk through solving a simple coding problem using the four-step problem-solving method. This allows us to see the method in action as we learn it. We'll use JavaScript as our language of choice. Here’s the problem:</p>
<p>Create a function that adds together two numbers and returns that value.  </p>
<p>There are four steps to the problem-solving method:</p>
<ol>
<li>Understand the problem.</li>
<li>Devise a plan.</li>
<li>Carry out the plan.</li>
<li>Look back. </li>
</ol>
<p>Let’s get started with step one.</p>
<h2 id="heading-step-1-understand-the-problem">Step 1: Understand the problem.</h2>
<p>When given a coding problem in an interview, it’s tempting to rush into coding. This is hard to avoid, especially if you have a time limit. </p>
<p>However, try to resist this urge. Make sure you actually understand the problem before you get started with solving it.</p>
<p>Read through the problem. If you’re in an interview, you could read through the problem out loud if that helps you slow down. </p>
<p>As you read through the problem, clarify any part of it you do not understand. If you’re in an interview, you can do this by asking your interviewer questions about the problem description. If you’re on your own, think through and/or Google parts of the question you might not understand.</p>
<p><strong>This first step is vital as we often don’t take the time to fully understand the problem. When you don’t fully understand the problem, you’ll have a much harder time solving it.</strong></p>
<p>To help you better understand the problem, ask yourself:</p>
<h3 id="heading-what-are-the-inputs">What are the inputs?</h3>
<p>What kinds of inputs will go into this problem? In this example, the inputs are the arguments that our function will take. </p>
<p>Just from reading the problem description so far, we know that the inputs will be numbers. But to be more specific about what the inputs will be, we can ask:</p>
<p>Will the inputs always be just two numbers? What should happen if our function receives as input <em>three</em> numbers? </p>
<p>Here we could ask the interviewer for clarification, or look at the problem description further. </p>
<p>The coding problem might have a note saying, “You should only ever expect two inputs into the function.” If so, you know how to proceed. You can get more specific, as you’ll likely realize that you need to ask more questions on what kinds of inputs you might be receiving.</p>
<p>Will the inputs always be numbers? What should our function do if we receive the inputs “a” and “b”? Clarify whether or not our function will always take in numbers.</p>
<p>Optionally, you could write down possible inputs in a code comment to get a sense of what they’ll look like: </p>
<p><code>//inputs: 2, 4</code></p>
<p>Next, ask:</p>
<h3 id="heading-what-are-the-outputs">What are the outputs?</h3>
<p>What will this function return? In this case, the output will be one number that is the result of the two number inputs. Make sure you understand what your outputs will be.</p>
<h3 id="heading-create-some-examples">Create some examples.</h3>
<p>Once you have a grasp of the problem and know the possible inputs and outputs, you can start working on some concrete examples.</p>
<p>Examples can also be used as sanity checks to test your eventual problem. Most code challenge editors that you’ll work in (whether it’s in an interview or just using a site like Codewars or HackerRank) have examples or test cases already written for you. Even so, writing out your own examples can help you cement your understanding of the problem.</p>
<p>Start with a simple example or two of possible inputs and outputs. Let's return to our addition function.</p>
<p>Let’s call our function “add.”</p>
<p>What’s an example input? Example input might be:</p>
<p><code>// add(2, 3)</code> </p>
<p>What is the output to this? To write the example output, we can write: </p>
<p><code>// add(2, 3) ---&gt; 5</code></p>
<p>This indicates that our function will take in an input of 2 and 3 and return 5 as its output.</p>
<h3 id="heading-create-complex-examples">Create complex examples.</h3>
<p>By walking through more complex examples, you can take the time to look for edge cases you might need to account for.</p>
<p>For example, what should we do if our inputs are strings instead of numbers? What if we have as input two strings, for example, add('a', 'b')?</p>
<p>Your interviewer might possibly tell you to return an error message if there are any inputs that are not numbers. If so, you can add a code comment to handle this case if it helps you remember you need to do this.</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// return error if inputs are not numbers.</span>
</code></pre>
<p>Your interviewer might also tell you to assume that your inputs will always be numbers, in which case you don’t need to write any extra code to handle this particular input edge case.</p>
<p>If you don’t have an interviewer and you’re just solving this problem, the problem might say what happens when you enter invalid inputs. </p>
<p>For example, some problems will say, “If there are zero inputs, return undefined.” For cases like this, you can optionally write a comment.</p>
<p><code>// check if there are no inputs.</code></p>
<p><code>// If no inputs, return undefined.</code></p>
<p>For our purposes, we’ll assume that our inputs will always be numbers. But generally, it’s good to think about edge cases. </p>
<p>Computer science professor Evans says to write what developers call <em>defensive</em> code. Think about what could go wrong and how your code could defend against possible errors.  </p>
<p>Before we move on to step 2, let’s summarize step 1, understand the problem: </p>
<p><code>-Read through the problem.</code></p>
<p><code>-What are the inputs?</code></p>
<p><code>-What are the outputs?</code></p>
<p><code>Create simple examples, then create more complex ones.</code></p>
<h2 id="heading-2-devise-a-plan-for-solving-the-problem">2. Devise a plan for solving the problem.</h2>
<p>Next, devise a plan for how you’ll solve the problem. As you devise a plan, write it out in pseudocode. </p>
<p>Pseudocode is a plain language description of the steps in an algorithm. In other words, your pseudocode is your step-by-step plan for how to solve the problem.</p>
<p>Write out the steps you need to take to solve the problem. For a more complicated problem, you’d have more steps. For this problem, you could write:</p>
<p><code>// Create a sum variable.</code></p>
<p><code>Add the first input to the second input using the addition operator</code>.</p>
<p><code>// Store value of both inputs into sum variable.</code></p>
<p><code>// Return as output the sum variable.</code>  </p>
<p>Now you have your step-by-step plan to solve the problem.  </p>
<p>For more complex problems, professor Evans notes, “Consider systematically how a human solves the problem.” That is, forget about how your code might solve the problem for a moment, and think about how <em>you</em> would solve it as a human. This can help you see the steps more clearly.</p>
<h2 id="heading-3-carry-out-the-plan-solve-the-problem">3. Carry out the plan (Solve the problem!)</h2>
<p><img src="https://cdn.pixabay.com/photo/2017/04/06/15/02/hand-2208491_960_720.jpg" alt="Hand, Rubik, Cube, Puzzle, Game, Rubik Cube" width="600" height="400" loading="lazy"></p>
<p>The next step in the problem-solving strategy is to solve the problem. Using your pseudocode as your guide, write out your actual code. </p>
<p>Professor Evans suggests focusing on a simple, mechanical solution. The easier and simpler your solution is, the more likely you can program it correctly.</p>
<p>Taking our pseudocode, we could now write this:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">a, b</span>) </span>{
 <span class="hljs-keyword">const</span> sum = a + b;
 <span class="hljs-keyword">return</span> sum;
}
</code></pre>
<p>Professor Evans adds, remember not to <em>prematurely optimize.</em> That is, you might be tempted to start saying, “Wait, I’m doing this and it’s going to be inefficient code!”</p>
<p>First, just get out your simple, mechanical solution.</p>
<p>What if you can’t solve the entire problem? What if there's a part of it you still don't know how to solve? </p>
<p>Colt Steele gives great advice here: If you can’t solve part of the problem, ignore that hard part that’s tripping you up. Instead, focus on everything else that you can start writing. </p>
<p>Temporarily ignore that difficult part of the problem you don’t quite understand and write out the other parts. Once this is done, come back to the harder part.</p>
<p>This allows you to get at least <em>some</em> of the problem finished. And often, you’ll realize how to tackle that harder part of the problem once you come back to it.</p>
<h2 id="heading-step-4-look-back-over-what-youve-done">Step 4: Look back over what you've done.</h2>
<p>Once your solution is working, take the time to reflect on it and figure out how to make improvements. This might be the time you refactor your solution into a more efficient one. </p>
<p>As you look at your work, here are some questions Colt Steele suggests you ask yourself to figure out how you can improve your solution:</p>
<ul>
<li>Can you derive the result differently? What other approaches are there that are viable?</li>
<li>Can you understand it at a glance? Does it make sense?</li>
<li>Can you use the result or method for some other problem?</li>
<li>Can you improve the performance of your solution?</li>
<li>Can you think of other ways to refactor?</li>
<li>How have other people solved this problem?</li>
</ul>
<p>One way we might refactor our problem to make our code more concise: removing our variable and using an implicit return:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">a, b</span>) </span>{
 <span class="hljs-keyword">return</span> a + b;
}
</code></pre>
<p>With step 4, your problem might never feel finished. Even great developers still write code that they later look at and want to change. These are guiding questions that can help you.</p>
<p>If you still have time in an interview, you can go through this step and make your solution better. If you are coding on your own, take the time to go over these steps. </p>
<p>When I’m practicing coding on my own, I almost always look at the solutions out there that are more elegant or effective than what I’ve come up with. </p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>In this post, we’ve gone over the four-step problem-solving strategy for solving coding problems. </p>
<p>Let's review them here:</p>
<ul>
<li>Step 1: <strong>understand the problem.</strong> </li>
<li>Step 2: <strong>create a step-by-step plan for how you’ll solve it</strong>. </li>
<li>Step 3: <strong>carry out the plan</strong> and write the actual code. </li>
<li>Step 4: <strong>look back</strong> and possibly refactor your solution if it could be better.</li>
</ul>
<p>Practicing this problem-solving method has immensely helped me in my technical interviews and in my job as a developer.  </p>
<p>If you don't feel confident when it comes to solving coding problems, just remember that problem-solving is a skill that anyone can get better at with time and practice.</p>
<p>Good luck!</p>
<h3 id="heading-if-you-enjoyed-this-post-join-my-coding-clubhttpsmadisonkannaus14list-managecomsubscribepostu323fd92759e9e0b8d4083d008ampid033dfeb98f-where-we-tackle-coding-challenges-together-every-sunday-and-support-each-other-as-we-learn-new-technologies">If you enjoyed this post, join my <a target="_blank" href="https://madisonkanna.us14.list-manage.com/subscribe/post?u=323fd92759e9e0b8d4083d008&amp;id=033dfeb98f">coding club</a>, where we tackle coding challenges together every Sunday and support each other as we learn new technologies.</h3>
<h3 id="heading-if-you-have-feedback-or-questions-on-this-post-feel-free-to-tweet-me-madisonkannahttpstwittercommadisonkanna">If you have feedback or questions on this post, feel free to Tweet me <a target="_blank" href="https://twitter.com/Madisonkanna">@madisonkanna</a>.</h3>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Interview for a Software Development Job: Success in the Wild West ]]>
                </title>
                <description>
                    <![CDATA[ By Ryan Dawson There are two big things I that I usually find missing in interviewing guides: Your chief aim as a candidate should be to make a connection and have a real conversation. You may not be given a good opportunity to make a connection. T... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-interview-for-software-development-jobs/</link>
                <guid isPermaLink="false">66d460c79208fb118cc6cffa</guid>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interviewing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Job Hunting ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Job Interview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 29 Dec 2020 17:16:48 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/12/wantedsigncoder.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Ryan Dawson</p>
<p>There are two big things I that I usually find missing in interviewing guides:</p>
<ol>
<li>Your chief aim as a candidate should be to make a connection and have a real conversation.</li>
<li>You may not be given a good opportunity to make a connection.</li>
</ol>
<p>There is no one formula for success in interviews because interviews are run like the Wild West. But you can maximize your chances.</p>
<h2 id="heading-how-to-connect-with-your-interviewer-through-stories">How to Connect with Your Interviewer through Stories</h2>
<p>Tech interview guides focus a lot on challenges, puzzles and tests. We should put more emphasis on the discussions to establish if you’re a fit for the role.</p>
<p>As a candidate it’s extremely valuable to be well prepared for the fit interview. It’s a chance to make a great impression at a personal level and not just as a test score.</p>
<p>A big part of this preparation is having stories that present the skills you want to present. Let’s consider examples of what this can look like.</p>
<h3 id="heading-example-interview-question-and-answer">Example Interview Question and Answer</h3>
<p><strong>Interviewer:</strong> Could you give me an example of something you worked on at company X?</p>
<p><strong>Candidate:</strong> One of my favourite projects was a performance improvement project. I introduced a new library for mapping code entities to the database. I also introduced a benchmarking tool to measure the improvement. It showed a speed-up of 40% for some queries.</p>
<p><strong>Interviewer:</strong> That's interesting, what did you enjoy particularly?</p>
<p><strong>Candidate:</strong> I enjoyed seeing the difference it made to the user experience. I also liked that it was a well-defined task and it was rewarding to get it done. I can talk more about the challenges if you like?</p>
<p><strong>Interviewer:</strong> Sure, what would you say was the biggest challenge on that piece of work? </p>
<p><strong>Candidate:</strong> Well I knew which library I wanted to migrate to. But it wasn’t compatible with another library we were using. I saw that it would become compatible if we upgraded that other library. So I had to explain that and get agreement to do the upgrade. There were some code changes involved and one of the others was initially reluctant. I convinced them by doing a small PoC to show that the changes weren’t that big.</p>
<p>Preparing stories that answer the first question in this exchange is good preparation. But the big value is in the follow-on conversation. That’s where the interviewer really gets to <em>see</em> your problem-solving skills. And in this case, also your teamwork skills.</p>
<p>You don’t want to just aim to be telling stories. You want to be bringing the interviewer with you through your accomplishments. Those accomplishments don’t make sense unless you reveal what was difficult about them.</p>
<p>Sharing your experience effectively is even more important for more senior roles.</p>
<p><strong>Interviewer:</strong> What was the best thing you did at company X?</p>
<p><strong>Candidate:</strong> I led the implementation of a new feature to generate business insight reports. It was very well received and helped lead to doubling of sales.</p>
<p><strong>Interviewer:</strong> How did you ensure the reports offered the insights the business was looking for?</p>
<p><strong>Candidate:</strong> It took a couple of iterations to get them right. We agreed on initial specs but they were a bit rough and the business wasn't very clear from the beginning. In the second iteration they got more excited and could guide us more clearly.</p>
<p><strong>Interviewer:</strong> Why do you think the business wasn't excited until the second iteration?</p>
<p><strong>Candidate:</strong> I think the mockups we'd done for the first didn't feel real to them. We'd mocked the data and they needed to see it with some of the real records to see the value they could get from it.</p>
<p>Here the initial story doesn’t demonstrate much. It asserts an achievement but it doesn’t <em>demonstrate</em>. The answers to the follow-ups show an appreciation of stakeholder management and requirements solicitation. Getting a flow of conversation going like this also helps the interviewer to relate.</p>
<p>Both of these example exchanges do well at making a connection. The answers get to the point and are explained so that the interviewer can understand them. They tell stories of overcoming challenges. They show appreciation of tricky problems as well as good collaboration skills.</p>
<p>Have stories prepared that show off your experience. Be prepared to answer questions like “<a target="_blank" href="https://www.themuse.com/advice/star-interview-method">tell me about a time when</a>…” If you’re well prepared you’ll look forward to these questions. They can lead to good discussions.</p>
<h2 id="heading-get-to-know-the-company">Get to Know the Company</h2>
<p>Your conversations will be more productive if you tailor them to the company and the role. Look at what the company does and what tech they use.</p>
<p>When you know a little about the company, think about which stories you’d like to emphasise. Which of your experiences would be most relevant to this role?</p>
<p>The job ad likely says which skills are must-haves and how much experience they’re looking for. It’s ok to not match it perfectly. Think about where you are a strong fit and emphasise that. Acknowledge your limitations and stress that you’d be keen to learn to fill the gaps.</p>
<p>You’re more likely to get favourable questions if you tailor your CV to the job ad. This need not be a lot of work. It could just be re-ordering so that the most relevant skills and experiences feature more prominently.</p>
<h2 id="heading-how-to-connect-with-your-interviewer-through-thinking">How to Connect with Your Interviewer through Thinking</h2>
<p>Of course it’s not all about stories. The tech skills are crucial. But the technical evaluations are not just a chance to demonstrate tech skills. They’re also a chance to relate personally.</p>
<p>Don’t treat the tech parts as simply a test of knowledge. They should be tests of reasoning.</p>
<p>Take every opportunity to reveal your thinking. Say why you chose one approach rather than another. Say what you like about a technology and what you’ve found awkward. </p>
<p>It is usually ok to not know an answer. Share your thoughts and be interested in how to get to the right answer, if there is one. </p>
<p>Expect to be challenged on exactly how far your knowledge and experience goes. Maybe you don’t have experience using technology X for millions of transactions. Acknowledge that. Talk about what scale you have dealt with and how you would scale higher.</p>
<p>Sometimes you’ll get ‘gotcha’ questions. Questions where the interviewer really wants some obscure piece of knowledge you don’t have. Try to turn them into conversations. </p>
<p>You want to show that you are flexible and that you’re someone the interviewer could work with. That involves being humble about what you don’t know. Try to show that you could go on learning journeys together.  </p>
<p>You should be prepared to be challenged with coding exercises. Look up what you can about how the company hires. It’s ok to ask them what to expect in the process.</p>
<h2 id="heading-how-to-achieve-your-goals">How to Achieve your Goals</h2>
<blockquote>
<p>“We do not learn from experience… we learn from reflecting on experience.” - John Dewey, Philosopher</p>
</blockquote>
<p>Interview prep takes time. Getting your stories prepared has to compete for time with technical preparation. You’ll want to tailor this to the company.</p>
<p>The key point is not about what prep to do. It’s about how to approach the interview.</p>
<p>Making a connection maximises our chances. Even if we make mistakes in the process, the interviewer is more likely to be generous to us if they relate to our experience and thinking.</p>
<p>The process of thinking about what we want to emphasise is also a good growth exercise. It forces us to consider which of our skills are most marketable. And also what we most enjoy.</p>
<p>We’ve a better chance of landing a role if we can explain how it would fit into our personal growth story. We want to be clear what attracts us to the role and how we’d grow with it.</p>
<p>The interviewer will likely ask us why we’re interested in the role. We should have a compelling answer, both for the interviewer and for ourselves.</p>
<h2 id="heading-interviews-are-the-wild-west">Interviews are the Wild West</h2>
<p>Candidates tend to assume interviewers have everything together. We assume that it’s a great company with a great interview process. So obviously if the interview goes badly it must be our fault?</p>
<p>Even in great companies you get messy hiring situations. </p>
<p>There may be multiple people in the hiring process and they may disagree on what they want. You may get one interviewer open to more junior candidates with an aptitude to learn. And another interviewer who wants all the relevant skills right away. </p>
<p>The interviewer should be trying to have a conversation with you. They should be trying to see how you approach problems and whether you’re somebody they could work with.</p>
<p>Unfortunately the interviewer might not be looking for conversation. They may be rushed or having a bad day. They may have limited thinking space. </p>
<p>Rarely is anyone trained in interviewing. Some people seem strangely ok with making interviews an exercise in ticking boxes. Or a kind of chess game to find faults.</p>
<p>The most common weakness in interviewers is being under-prepared and rushed. This leads to a passive approach to interviewing where the interviewer basically sits back and waits for you to impress them.</p>
<p>Tell stories about good work that you’re proud of. Stories about overcoming obstacles and making trade-offs. Try to relate the stories to what you know about the role. Where you’re not sure how your experience relates to the role, drop in the odd question to show how interested you are.</p>
<h2 id="heading-how-to-succeed-in-the-wild-west-of-software-interviews">How to Succeed in the Wild West of Software Interviews</h2>
<p>Think about what the interviewer is looking for. Which skills are must-haves and how much experience they want. Even ask them.</p>
<p>Have stories prepared and think about how to relate them to the role. Use your CV so that it prompts the questions you want. Stories aren’t the <a target="_blank" href="https://www.freecodecamp.org/news/how-to-prepare-for-a-software-developer-interview/">whole interview process</a> but they are typically the centrepiece.</p>
<p>Have questions prepared to show how interested you are. Really try to imagine what you’d be doing day to day.</p>
<p>Think about how relatable each of your stories are. Make sure you tell them in a way that doesn’t require too much insider language or context.</p>
<p>The way to succeed in the Wild West of interviews is not to be an awesome gunslinger. It’s by being awesome at making new friends.   </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Problem Solving Patterns for Technical Interviews: the Frequency Counter Pattern Explained ]]>
                </title>
                <description>
                    <![CDATA[ By Martin Cartledge In my last article, I shared my thoughts on how to prepare for a software developer interview.  In this article, I am going to switch gears a bit and talk about common patterns you can use to solve problems in technical interviews... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/solve-technical-interview-questions-using-frequency-counter/</link>
                <guid isPermaLink="false">66d4601a51f567b42d9f8493</guid>
                
                    <category>
                        <![CDATA[ career advice ]]>
                    </category>
                
                    <category>
                        <![CDATA[ careers ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interview tips ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Interviews ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ self-improvement  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Fri, 18 Dec 2020 21:48:23 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/12/beach.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Martin Cartledge</p>
<p>In my last article, I shared my thoughts on how to <a target="_blank" href="https://www.martincartledge.io/prepare-for-software-developer-interview/">prepare for a software developer interview</a>. </p>
<p>In this article, I am going to switch gears a bit and talk about common patterns you can use to solve problems in technical interviews. We'll discuss the <em>frequency counter</em> pattern in depth to help you tackle it effectively.</p>
<h2 id="heading-what-is-the-frequency-counter-pattern">What is the “Frequency Counter” pattern?</h2>
<p>The Frequency Counter pattern uses an object or set to collect values and the frequency of those values.</p>
<p>This pattern is often used with an <code>array</code> or a <code>string</code>, and allows you to avoid nested loops (quadratic time complexity <code>O(n²)</code>).</p>
<h2 id="heading-when-should-i-use-the-frequency-counter-pattern">When should I use the Frequency Counter pattern?</h2>
<p>The Frequency Counter pattern is most helpful when you have multiple pieces of data that you want to compare with one another. Let me walk you through an example to see the Frequency Counter in action.</p>
<h2 id="heading-the-samesquared-exercise">The "sameSquared" exercise</h2>
<ul>
<li>Write a function called <code>sameSquared</code> which accepts two arrays</li>
<li>The function should return <code>true</code> if <em>every</em> value in the first array has its corresponding value squared in the second array</li>
<li>The frequency of the values must be the same</li>
</ul>
<h3 id="heading-what-is-the-optimal-outcome">What is the optimal outcome?</h3>
<p>After our function is written, we should expect our <code>sameSquared</code> function to return these values.</p>
<p><code>sameSquared([1, 2, 3], [4, 1, 9]); _// true_</code></p>
<p><code>sameSquared([1, 2, 3], [1, 9]); _// false_</code></p>
<p><code>sameSquared([1, 2, 1], [4, 4, 1]); _// false_</code></p>
<p><code>sameSquared([2, 3, 6, 8, 8], [64, 36, 4, 9, 64]); _// true_</code></p>
<h3 id="heading-getting-started">Getting started</h3>
<p>First, using the <code>function</code> keyword, we create a function with the identifier <code>sameSquared</code>:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sameSquared</span>(<span class="hljs-params"></span>) </span>{
</code></pre>
<p>Our function <code>sameSquared</code> needs two parameters, a first array and a second array. In this example, we are passing these values <code>[1, 2, 3]</code> and <code>[4, 1, 9]</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sameSquared</span>(<span class="hljs-params">firstArr, secondArr</span>) </span>{
</code></pre>
<h3 id="heading-check-edge-cases">Check edge cases</h3>
<p>Inside of our function block, we want to address a few edge cases. First, we need to check that both parameters have truthy values, that is <em>not</em> <code>null</code>, <code>undefined</code>, and so on. </p>
<p>We can check for a falsy value by using the <code>!</code> operator. If <code>firstArr</code> or <code>secondArr</code> is falsy, we return <code>false</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sameSquared</span>(<span class="hljs-params">firstArr, secondArr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstArr || !secondArr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
</code></pre>
<p>The next edge case we want to account for is to ensure that the length of both arrays are the same. If they are different, we know that they can <em>not</em> contain an equal amount of shared values.</p>
<p>By checking the <code>length</code> property on both parameters, we can determine if they are the same. If they are not, we return <code>false</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sameSquared</span>(<span class="hljs-params">firstArr, secondArr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstArr || !secondArr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstArr.length !== secondArr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
</code></pre>
<h3 id="heading-build-a-dictionary-to-avoid-nested-loops">Build a "dictionary" to avoid nested loops</h3>
<p>We need to keep track of all values in at least one of the arrays. To do this, and to avoid a nested loop, we can store these values in a hash table (object). I’ll call mine <code>lookup</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sameSquared</span>(<span class="hljs-params">firstArr, secondArr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstArr || !secondArr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstArr.length !== secondArr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;

  <span class="hljs-keyword">const</span> lookup = {};
</code></pre>
<p>Using a <code>for of</code> loop, we iterate through the <code>firstArr</code>. Inside of the <code>for of</code> block, we assign the key to the result of <code>value * value</code>.</p>
<p>The value in this key/value pair will be a <em>frequency counter</em> that reflects how many times a specific value is “seen” in the <code>firstArr</code>.</p>
<p>First, we check if <code>lookup</code> contains an entry for <code>value * value</code>, if it does, we add <code>1</code> to it. If it does not, we assign the value to <code>0</code> and then add <code>1</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sameSquared</span>(<span class="hljs-params">firstArr, secondArr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstArr || !secondArr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstArr.length !== secondArr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;

  <span class="hljs-keyword">const</span> lookup = {};

  <span class="hljs-keyword">for</span> (value <span class="hljs-keyword">of</span> firstArr) {
    lookup[value * value] = (lookup[value * value] || <span class="hljs-number">0</span>) + <span class="hljs-number">1</span>;
  }
</code></pre>
<p>Once the <code>firstArr</code> is finished looping, the <code>lookup</code> should contain these values:</p>
<pre><code class="lang-javascript">{
  <span class="hljs-number">1</span>: <span class="hljs-number">1</span>,
  <span class="hljs-number">4</span>: <span class="hljs-number">1</span>,
  <span class="hljs-number">9</span>: <span class="hljs-number">1</span>
}
</code></pre>
<h3 id="heading-compare-array-values">Compare array values</h3>
<p>Now that we have iterated through all of the values in the <code>firstArr</code> and stored them as their respective <em>squared</em> value, we want to compare those values to the values in the <code>secondArr</code>.</p>
<p>We start by creating another <code>for of</code> loop. On the first line inside of our new <code>for of</code> block, we write a conditional statement to check if the current value from our <code>secondArr</code> is <em>not</em> inside of our <code>lookup</code>. If it is not, we stop looping and return <code>false</code>.</p>
<p>If the value from the <code>secondArr</code> is in our <code>lookup</code>, we want to decrement the value of that entry. We can do so by using the <code>-=</code> assignment operator.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sameSquared</span>(<span class="hljs-params">firstArr, secondArr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstArr || !secondArr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstArr.length !== secondArr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;

  <span class="hljs-keyword">const</span> lookup = {};
  <span class="hljs-keyword">for</span> (value <span class="hljs-keyword">of</span> firstArr) {
    lookup[value * value] = (lookup[value * value] || <span class="hljs-number">0</span>) + <span class="hljs-number">1</span>;
  }
  <span class="hljs-keyword">for</span> (secondValue <span class="hljs-keyword">of</span> secondArr) {
    <span class="hljs-keyword">if</span> (!lookup[secondValue]) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
      lookup[secondValue] -= <span class="hljs-number">1</span>;
    }
</code></pre>
<p>After we are finished looping through the <code>secondArr</code>, our <code>lookup</code> should have these values:</p>
<pre><code class="lang-javascript">{
  <span class="hljs-number">1</span>: <span class="hljs-number">0</span>,
  <span class="hljs-number">4</span>: <span class="hljs-number">0</span>,
  <span class="hljs-number">9</span>: <span class="hljs-number">0</span>
}
</code></pre>
<h3 id="heading-wrapping-up-our-samesquared-function">Wrapping up our "sameSquared" function</h3>
<p>If we finish iterating through the <code>secondArr</code> without returning <code>false</code>, that means that our <code>firstArr</code> contains all values that are in a squared state in the <code>secondArr</code>. Therefore, we return <code>true</code> outside of <code>for of</code> loop.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sameSquared</span>(<span class="hljs-params">firstArr, secondArr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstArr || !secondArr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstArr.length !== secondArr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;

  <span class="hljs-keyword">const</span> lookup = {};
  <span class="hljs-keyword">for</span> (value <span class="hljs-keyword">of</span> firstArr) {
    lookup[value * value] = (lookup[value * value] || <span class="hljs-number">0</span>) + <span class="hljs-number">1</span>;
  }
  <span class="hljs-keyword">for</span> (secondValue <span class="hljs-keyword">of</span> secondArr) {
    <span class="hljs-keyword">if</span> (!lookup[secondValue]) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    lookup[secondValue] -= <span class="hljs-number">1</span>;
  }
  <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
}
</code></pre>
<p>Let me show you another example which is used very commonly in coding assessments (so you might’ve seen this problem before).</p>
<h2 id="heading-the-isanagram-exercise">The "isAnagram" exercise</h2>
<ul>
<li>Write a function called <code>isAnagram</code> which accepts two strings</li>
<li>The function should return <code>true</code> if the two strings parameters are <a target="_blank" href="https://en.wikipedia.org/wiki/Anagram">anagrams</a> of each other</li>
</ul>
<h3 id="heading-what-is-the-optimal-outcome-1">What is the optimal outcome?</h3>
<p>After our function is written, we should expect our <code>isAnagram</code> function to return these values.</p>
<p><code>isAnagram(“silent”, “listen”); _// true_</code></p>
<p><code>isAnagram(“martin”, “nitram”); _// true_</code></p>
<p><code>isAnagram(“cat”, “tag”); _// false_</code></p>
<p><code>isAnagram(“rat”, “tar”); _// true_</code></p>
<h3 id="heading-getting-started-1">Getting started</h3>
<p>First, using the <code>function</code> keyword, we create a function with the identifier <code>isAnagram</code>:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isAnagram</span>(<span class="hljs-params"></span>) </span>{
</code></pre>
<p>Our function <code>isAnagram</code> needs two parameters, a first <code>string</code> and a second <code>string</code>. In this example, we are passing these value, <code>silent</code> and <code>listen</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isAnagram</span>(<span class="hljs-params">firstStr, secondStr</span>) </span>{
</code></pre>
<h3 id="heading-check-edge-cases-1">Check edge cases</h3>
<p>On the first few lines of our function block, we want to address a few edge cases, just like in the first example. </p>
<p>Similar to <code>isAnagram</code>, we need to check that both parameters have truthy values, that is <em>not</em> <code>null</code>, <code>undefined</code>, and so on. We can check for a falsy value by using the <code>!</code> operator. If <code>firstStr</code> or <code>secondStr</code> is falsy, we return <code>false</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isAnagram</span>(<span class="hljs-params">firstStr, secondStr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstStr || !secondStr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
</code></pre>
<p>The next edge case we want to account for is to ensure that the length of both arrays are the same. If they are different, we know that they can <em>not</em> contain an equal number of shared values.</p>
<p>By checking the <code>length</code> property on both parameters, we can determine if they are the same. If they are not, we return <code>false</code></p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isAnagram</span>(<span class="hljs-params">firstStr, secondStr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstStr || !secondStr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstStr.length !== secondStr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
</code></pre>
<h3 id="heading-build-a-dictionary-to-avoid-nested-loops-1">Build a "dictionary" to avoid nested loops</h3>
<p>Remember, we are using the frequency counter pattern and we need to keep track of all values in at least one of the arrays. Now we know that the best way to handle this is to store these values in a hash table (object). To keep things consistent, I’ll call mine <code>lookup</code> again.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isAnagram</span>(<span class="hljs-params">firstStr, secondStr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstStr || !secondStr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstStr.length !== secondStr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;

  <span class="hljs-keyword">const</span> lookup = {};
</code></pre>
<p>Using a <code>for of</code> loop, we iterate through the <code>firstStr</code>. Inside of the <code>for of</code> block, we assign the key to the result of the expression <code>value * value</code>.</p>
<p>The value in this key/value pair will be a <em>frequency counter</em> that reflects how many times a specific value is “seen” in the <code>firstStr</code>.</p>
<p>Using a ternary operator, we check if <code>lookup</code> contains an entry for <code>value * value</code>, if it does, we use the <code>+=</code> assignment operator to increment the value by <code>1</code>. If it does not, we simply assign the value to <code>1</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isAnagram</span>(<span class="hljs-params">firstStr, secondStr</span>) </span>{
    <span class="hljs-keyword">if</span> (!firstStr || !secondStr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    <span class="hljs-keyword">if</span> (firstStr.length !== secondStr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;

    <span class="hljs-keyword">const</span> lookup = {};

    <span class="hljs-keyword">for</span> (first <span class="hljs-keyword">of</span> firstStr) {

        lookup[first] ? (lookup[first] += <span class="hljs-number">1</span>) : (lookup[first] = <span class="hljs-number">1</span>);

  }
</code></pre>
<p>Once the <code>firstStr</code> is finished looping, the <code>lookup</code> should contain these values:</p>
<pre><code class="lang-javascript">{
  <span class="hljs-attr">s</span>: <span class="hljs-number">1</span>,
  <span class="hljs-attr">i</span>: <span class="hljs-number">1</span>,
  <span class="hljs-attr">l</span>: <span class="hljs-number">1</span>,
  <span class="hljs-attr">e</span>: <span class="hljs-number">1</span>,
  <span class="hljs-attr">n</span>: <span class="hljs-number">1</span>,
  <span class="hljs-attr">t</span>: <span class="hljs-number">1</span>
}
</code></pre>
<h3 id="heading-compare-array-values-1">Compare array values</h3>
<p>Now that we have iterated through all of the values in the <code>firstStr</code> and stored their values, we want to compare those values to the values in the <code>secondStr</code>.</p>
<p>We start by creating another <code>for of</code> loop. On the first line inside of our new <code>for of</code> block, we write a conditional statement to check if the current value from our <code>secondStr</code> is <em>not</em> inside of our <code>lookup</code>. If it is not, we want to stop iteration and return <code>false</code>.</p>
<p>Otherwise, if the value from the <code>secondStr</code> <em>is</em> in our <code>lookup</code>, we want to decrement the value of that entry. We can do so by using the <code>-=</code> assignment operator.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isAnagram</span>(<span class="hljs-params">firstStr, secondStr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstStr || !secondStr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstStr.length !== secondStr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;

  <span class="hljs-keyword">const</span> lookup = {};

  <span class="hljs-keyword">for</span> (first <span class="hljs-keyword">of</span> firstStr) {
    lookup[first] ? (lookup[first] += <span class="hljs-number">1</span>) : (lookup[first] = <span class="hljs-number">1</span>);
  }

  <span class="hljs-keyword">for</span> (second <span class="hljs-keyword">of</span> secondStr) {
    <span class="hljs-keyword">if</span> (!lookup[second]) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    lookup[second] -= <span class="hljs-number">1</span>;
  }
</code></pre>
<p>After we are finished looping through the <code>secondStr</code>, our <code>lookup</code> should have these values:</p>
<pre><code class="lang-javascript">{
  <span class="hljs-attr">s</span>: <span class="hljs-number">0</span>,
  <span class="hljs-attr">i</span>: <span class="hljs-number">0</span>,
  <span class="hljs-attr">l</span>: <span class="hljs-number">0</span>,
  <span class="hljs-attr">e</span>: <span class="hljs-number">0</span>,
  <span class="hljs-attr">n</span>: <span class="hljs-number">0</span>,
  <span class="hljs-attr">t</span>: <span class="hljs-number">0</span>
}
</code></pre>
<h3 id="heading-wrapping-up-our-isanagram-function">Wrapping up our "isAnagram" function</h3>
<p>If we finish iterating through the <code>secondStr</code> without returning <code>false</code>, that means that our <code>firstStr</code> contains all values that are in the <code>secondStr</code>. Therefore, we return <code>true</code> outside of <code>for of</code> loop.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isAnagram</span>(<span class="hljs-params">firstStr, secondStr</span>) </span>{
  <span class="hljs-keyword">if</span> (!firstStr || !secondStr) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  <span class="hljs-keyword">if</span> (firstStr.length !== secondStr.length) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;

  <span class="hljs-keyword">const</span> lookup = {};

  <span class="hljs-keyword">for</span> (first <span class="hljs-keyword">of</span> firstStr) {
    lookup[first] ? (lookup[first] += <span class="hljs-number">1</span>) : (lookup[first] = <span class="hljs-number">1</span>);
  }

  <span class="hljs-keyword">for</span> (second <span class="hljs-keyword">of</span> secondStr) {
    <span class="hljs-keyword">if</span> (!lookup[second]) <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    lookup[second] -= <span class="hljs-number">1</span>;
  }
  <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
}
</code></pre>
<h2 id="heading-in-summary">In Summary</h2>
<p>I hope this in-depth overview of the Frequency Counter pattern was helpful. Now that you know how the pattern works, I am confident that you will be able to impress your interviewer by showcasing your skills at an even higher level.</p>
<p>In my next article, I will be discussing another common problem-solving pattern called the Sliding Window. Thanks for reading, and happy interviewing!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
