---
# System prepended metadata

title: Introductory LeetBook

---

---
title: 'Introductory LeetBook'
disqus: hackmd
---


LeetBook: Intro to LeetCode
===

## Objective

Increase new user retention rate by providing a LeetBook (Explore Card) that reduces the learning curve required to become familiar with the LeetCode platform.

Project Timeline
---

```mermaid
gantt
    axisFormat %m-%d
    title Introductory LeetBook

    section Framework
    Content Outline : a1, 2022-03-22, 7d
    Feedback        : 2022-03-27, 2d
    Revise Text     : a2, after a1, 2d
    Format LB       : after a1, 2d
    Revise Text     : 2022-04-07, 2d
    
    section Test Environment
    Launch  : after a2, 2d
    Publish : milestone, 2022-04-09, 0d
    
    section Visual Aids
    Create and Revise Videos      : after a2, 9d
    Create Supporting Visual Aids : after a2, 9d
```

UPDATED

```mermaid
gantt
    axisFormat %m-%d
    title Introductory LeetBook

    section Framework
    Video Feedback : done, a1, 2022-04-05, 2d
    Revise Text     : done, a2, after a1, 1d
    Format LB       : after a1, 1d
    
    section Test Environment
    Launch         : 2022-04-12, 1d
    Polish Content : 2022-04-12, 3d
    Publish        : milestone, 2022-04-15, 0d
    
    section Visual Aids
    Create and Revise Videos      : after a1, 8d
    Create Supporting Visual Aids : done, after a1, 6d
    Create Good vs Bad Example Post: 2022-04-09, 6d
```

## Uncertainties

1. The video outlines are for non-explore card problems because explore-card problems do not have features like the debugger, the discuss section tab, the more problems tab, hints drop down, etc. So rather than having two videos for everything, the outline here has videos only for non-explore card problems, then just mentions that the layout is a bit different and a few functionalities are not present. 
    - This feels a little sloppy - showing one layout, then asking the user to solve their first problem in another layout.  But I'm not sure how I feel about the idea of having two videos for each concept (one video for each layout). Open to other ideas.

2. I don't use the debug tool very often. I may need a recommendation in choosing a good bug to demonstrate it's capabilites on and what to say when explaining it to a new user.

3. Chapter 4 feels like a bit like a cheesy motivational speech, I'm not sure if I should reword it to be more generic and do away with categorizing the newcomers.  All of the content currently is subject to change or deletion.
    - Also, if we keep the structure, and categorize the users, should we include a MCQ page to help categorize them? (see "4. Where to Start" for example MCQs)

4. Should I omit 4.6? It feels a bit like an ethical gray area. This is crossing the line from saying we're a platform that helps you learn DSA to we're a platform that tells you what questions you are most likely to get. Although, this group (people who are on a time crunch) might be a significant portion of our unretained new users - which is our primary target :thinking_face: 

5. Is the card too big? Do I need to break it down a bit more to keep it focused and cut out the "This is where you should start" (section 4) or "This is how you can contribute while you're learning" (section 5)?

## Contents

### Overview

Some text welcoming the user and a table of contents explaining what content we will cover.

<hr>

### 1. Solving Your First Problem

Intro text summarizing what the following video will show.

<details>
    
<summary>Example Video: Solving Your First Problem</summary>
    
<br>
    
- Give specific super easy problem.
- Navigate to problem page.
    - Show search and filter functionality.
- Go to specific problem.
    - Draw attention to important features on the page:
        - Description, constraints, examples, hints, related topics and problems, field for typing your solution, submit/run buttons. 
        - **Keep it simple.** Do not show any advanced functions for now like custom test cases, visualize tree, view difference in output vs expected.
    - Show that you can choose any language you like, go to Python3 (note that the input field changes) and go back to Java.
    - Solve the problem.
        - Explain solution - one or two sentences for an extremely easy problem.
        - Click Run to show it works, click run all test cases, and submit.
    
</details>

<br>

Encourage user to go solve this problem on their own (include problem here) and mention that the layout is a little different within Explore Cards, but most of the functionality is the same.

<details>
    
<summary>Example Video: Additional Features</summary>
    
<br>

- Return to the same completed problem.
- Let's take a look at a few additional features:
    - Quick zoom on the top right functions.
    - Reset the code to default.
    - Retrieve old code.
    - Show Settings, adjust size, change theme (not to dark theme, some users may be turned away by only the editing field going dark).
    - Show full screen mode, and that we can slide the description field to make more or less room.
    - Click the "i" button to show more information about the version and automatically imported packages.
    - Show the submissions tab, here you can check out any of your past submissions.
        - Zoom in on the runtime distribution box using the click and drag tool. Here we can see the runtimes of other users who solved this problem.  Only your language will be shown in this plot.
        - You can also click "Edit Code" to work on this code again.

<br>

- Show the "Problems" window (hamburger in the bottom left)
    - Click category to show we can filter by different categories, click data base and mention that these are problems related to SQL. Then click back to algorithms.
    - Click the problem list dropdown, mention we can filter by top questions from different companies (don't click the companies), and click the top-liked questions.
    - Show filter capabilities here too: filter for easy, binary-tree problems
    - Click on "226. Invert Binary Tree", it has a colorful and short problem description, it's a notorious problem, and it has a good video solution. We will pick up with this problem in the next video.  
    
</details>

<hr>

### 2. Tools and Resources

After solving a problem on LeetCode (or if you are ever stuck on a problem) you can check the official and user-provided resources.

<details>
    
<summary>Example Video: Resources</summary>
    
<br>
    
- Pick up where the last video left off.
- Show the official solution.
    - Scroll down and mention the official solutions generally:
        - Contain multiple approaches.
        - Explain the intuition used to come up with each approach.
        - Supporting visual aids.
        - Complexity Analysis with explanation.
        - A comment section to discuss with other users.
- Show the discussion section.
    - Many users share their solutions.
    - Regardless of what language you use, you can usually find solutions here: Search for language.
    - Posts can be ordered by most recent or most votes: Sort by most votes.
    - Posts can also be filtered by tags
    - Most importantly, you can also contribute your ideas and solutions here.  We will go over this in more detail later in this tutorial.
        
    
</details>

<br>

Having trouble finding a bug in your code or understanding the input? 

<details>
    
<summary>Example Video: Debugging and Diff</summary>
    
<br>

- Show debugger. Any recommended example inputs for 266. Invert Binary Tree that could be used to showcase the debugger in an short and easy to follow way?
- Fix code after using debugger.
- Show how to run multiple test cases at once.
- Show visualization tool and click on each test case to show how the visualization tool shows the currently clicked test case.
- Create a custom test case to have several null and integer values to create a complicated tree where a visualization tool is especially handy.
- Intentionally break the code, i.e. change `current.left = current.right` to `current.right = current.left`, run code, then click the "Diff" button to see where your solution's output differs from the expected output.

</details>

<hr>

### 3. Practice

The following pages include 8 beginner friendly problems to help you get used to the LeetCode interface. You may notice that the interface is slightly different than what we have shown so far.  This is the same interface that is used in LeetCode contests and mock interviews.  As such, certain tools like a link to the discuss section and the debugger are not provided in this interface.  However, in LeetBooks, there is still a link to the official solution which you can use if you are stuck, or if you wish to compare the solution you come up with to the official solution.

:::info
[13\. Roman to Integer](https://leetcode.com/problems/qid/13)
[234\. Palindrome Linked List](https://leetcode.com/problems/qid/234)
[383\. Ransom Note](https://leetcode.com/problems/qid/383)
[412\. Fizz Buzz](https://leetcode.com/problems/qid/412)
[876\. Middle of the Linked List](https://leetcode.com/problems/middle-of-the-linked-list/)
[1337\. The K Weakest Rows in a Matrix](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/)
[1342\. Number of Steps to Reduce a Number to Zero](https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/)
[1672\. Richest Customer Wealth](https://leetcode.com/problems/richest-customer-wealth/)

It only takes maybe 1 or 2 problems to start to feel familiar with the process.  I may cut this list down to 3 or 4 problems in this chapter, then place the other 4 or 5 at the end of the chapter as further practice. I also might remove problem 13. It's easy, but it's the only one that doesn't necessarily fall into the super-easy category.
:::

<hr>

### 4. Where to Start

Where to start depends on your previous experience, your end goal, and how much time you have to prepare.  

{Maybe have a one page MCQ here with 10 progressively detailed questions? Then recommend a starting point based on how many questions they got right. This is just a thought, not sure if this is a good idea to implement. The reason for doing so would be to avoid any vagueness regarding where a user should start. Questions would not really be technical and would be more like "I know when to use BFS versus DFS vs Dijkstra's Algorithm. True/False", "Once I know the recurrence relation and base case(s), I feel comfortable writing a top-down or bottom up dynamic programming solution. True/False"}

#### 4.1 Complete Beginner to Novice

We've included a few more beginner friendly problems at the end of the chapter.  We recommend attempting them (as well as the previous problems).  Give each problem an honest try, then after you have solved the problem (or if you are completely stuck) check out the official solution and the discussion posts.  Right now your only focus is on learning the basics to solve problems and not necessarily on finding the optimal solution (we will get there in time). 

Next, check out our Explore Cards (LeetBooks) one by one.  You can use the following graphic to help avoid running into content that is too challenging.  For each topic, go through the tutorial material in the Explore Card, go to the problems page and pick out 10 suitable difficulty problems (easy-medium) spend 15-20 minutes trying to solve each one.  If you can't solve it after that time, that's okay, read and try to understand the solution, then return to the problem and try to solve it with what you've learned.  Over time the information you gain from reading others' solutions will help you to solve problems on your own without relying on the dicuss section or the official solution.  That said, **still read the discuss section and official solution when you solve the problem on your own.**  If you see a more efficient or a less complicated solution than your own, study it and take that information with you for future problems.

```mermaid
graph TD;
    R[Database];
    M{{Decision Tree}};
    N{{Machine Learning}};
    A(Array and String);
    B(Arrays);
    C(Queue and Stack);
    D(Hash Table);
    E(Binary Search);
    F(Recursion I);
    G(Recursion II);
    H(Linked List);
    I(Binary Tree);
    J(Binary Search Tree);
    K(Trie);
    L(N-ary tree);
	O(Dynamic Programming);
	P(Graph);
	Q(Heap);
    S(Arrays Advanced);
    
    B --> A;
    A --> C & D & E & Q & S;
    B & H --> F;
    F --> G;
    H --> I;
    I --> G & J & K & L;
    N --> M;
    G --> O;
    G --> P;
```

:::info
For the image, I'm envisioning something along these lines... but perhaps a little cleaner:
- More veritcally spaced out.
- An image for the background of each topic like the EC have.
- Image is clickable and goes to the explore card.

and preferably a graphic that can be easily regenerated (like the mermaid flow chart above), so it's easy to update when new LeetBooks are published.
:::

#### 4.2 Novice to Intermediate

{Probably familiar with linked lists, trees, recursion, and knows when to use a hash table or dictionary instead of searching in a list}

**This is just filler text - will probably change:** coming soon.

#### 4.3 Intermdiate to Advanced

{Strong with all of the basic DSA, but maybe still struggling to solve most hard problems, this user would solve 3 problems for most contests.} 

Recommend mock assessments and rerun contests, use these to find problems that they struggle with - use the discussion section and official solution to find which DSA they struggle with.  Use explore cards and the problems page to target those DSA, while at the same time consistently practicing other DSA through things like [daily coding challenge](https://leetcode.com/problemset/all/).  

#### 4.4 Advanced

{Knowledgable in all relevant topics.} 

If you are already at this stage, where you start only depends on your objective.  If you want to:
- become a better at coding competitions, compete in the [weekly/biweekly competitions](https://leetcode.com/contest/), or try [virtual competitions](https://leetcode.com/contest/), find problems that challenge you and study the related DSA. 
- prepare for interviews, try our curated list for the company of interest, or [mock assessments](https://leetcode.com/assessment/). 
- avoid getting rusty, try the [daily coding challenge](https://leetcode.com/problemset/all/). 

#### 4.5 Everyone

Regardless of what level you are, consistency is the key to learning new skills and to prevent existing skills from getting rusty.  The best way to stay consistent is to create a habit of exercising your skills every day - even if it's only signing on to do one problem a day, if you have time you can always do more.  Some great ways to remain consistent include:
- [Daily Coding Challenge](https://leetcode.com/problemset/all/)
- [Study Guides](https://leetcode.com/study-plan/)
- [Contests](https://leetcode.com/contest/)

It's never too early to start any of these. Success on the first try isn't the key. The **most** important thing is progress over time. It's not always visible over night, or even over weeks, but if you consistently **try** the daily coding challlenge, compete in contests, go through the explore cards and solve practice problems related to the topic you just learned, over time you will succeed more and more frequently.

[A few success stories](https://leetcode.com/discuss/general-discussion/1650089/Year-End-Review-Giveaway!) I'm not sure if I want to link this somewhere in here, but the comments are inspirational.

#### 4.6 Many of Us

Last but not least, you have 2 weeks until your interview and do not feel prepared.  Unfortunately, there's no magic button to learn everything overnight.  However, you can focus your studies to maximize your preparedness for a certain company.  

1. Go to the [Problem Page](https://leetcode.com/problemset/all/) and find your company in the company widget.  This is different from the company tag.  It will allow you to not only sort problems by how frequently they are asked, but do so over different time frames, i.e. the past 6, 12, or 24 months. Solve these problems on your own, read and understand the optimal solutions (often the easiest solution to find is suboptimal).
2. Search for your company in the [Interview Question Page](https://leetcode.com/discuss/interview-question?currentPage=1&orderBy=newest_to_oldest&query=) and practice recently asked questions.
3. Practice the relevant [Assessments/Interviews](https://leetcode.com/assessment/) for your company.
4. In each of these steps, any time you come across a DSA which you are not familiar with, check out the explore card, and do some practice problems to build up confidence with that DSA, then continue.


> Note, this is not a great strategy for learning DSA and is only recommended in a pinch.

<hr>

### 5. Contributing

On your journey you will likely be aided by many of the contributions that former LeetCoders have made.  Some [Good Example Contributions](https://leetcode.com/discuss/general-discussion/665604/Important-and-Useful-links-from-all-over-the-LeetCode) can be found here. 

As your skills grow and you become more comfortable with LeetCode and the community, you are also more than welcome to share your own contributions and experiences with current and future LeetCoders.  

**Here are some ways you can contribute:**

- Solutions to practice problems
    - In the discuss section of each problem as shown in an earlier video.  **Note: This is different from the main discuss section.** Every problem has its own discussion section.
- [Study Guides](https://leetcode.com/discuss/study-guide?currentPage=1&orderBy=hot&query=)
- [Interview Questions](https://leetcode.com/discuss/interview-question?currentPage=1&orderBy=hot&query=), [Experiences](https://leetcode.com/discuss/interview-experience?currentPage=1&orderBy=hot&query=), and [Compensation](https://leetcode.com/discuss/compensation?currentPage=1&orderBy=hot&query=)
    - **Read the pinned post on each page before sharing.**
    - Also, you can post anonymously.
- [Missing Test Cases](https://github.com/LeetCode-Feedback/LeetCode-Feedback/issues)
    - Please use careful consideration and exercise due diligence before submitting issues or recommending test cases. 

**Ready for your first contribution?**

You can contribute right now by sharing your thoughts about this LeetBook in the [discuss section]() (at the end of the navbar on the left). Did you find it helpful and what can we improve on?

#### 5.1 Everyone Likes to Read Clean Posts

It's always a good habit to write clean code that is easy for the next person (or you in a month) to pick up and understand.  That said, if you plan to contribute - and we hope you will - consider these few tips to make your contributions more valuable to everyone who reads them.

[Example of a sloppy post]() sloppy code, no explanation, no comments, didn't use the language tag after \`\`\` 
[Example of the same post but clean]() meaningful variable names, 4 space indentation, correct tag, good explanation, complexity analysis, and a picture

- Briefly mention each of the items that make it clean:
    - Formatting: [Markdown and Playground](https://leetcode.com/discuss/general-discussion/1560831/markdown-reference-for-leetcode-formatting-cheatsheet)
    - Clear Explanations and Comments
    - Complexity Analysis
    - Sometimes multiple approaches
    - Add tags so your approach shows up in more searches
    - Edit your post as needed

<hr>

### 6. Additional Beginner Friendly Problems

Congratulations on completing your first LeetBook! We have collected a few more beginner friendly problems for you to practice. Remember, regardless of which preparation strategy you choose, consistency is the key to success, and we hope to see you again, tomorrow.

:::info
Add any of the 8 beginner problems that were not already included in the card.
:::