Giter Club home page Giter Club logo

leetcode-patterns's Introduction

Leetcode Patterns github-pages run-cron

Table of Contents

Background

This repo is intended for any individual wanting to improve their problem solving skills for software engineering interviews.

Problems are grouped under their respective subtopic, in order to focus on repeatedly applying common patterns rather than randomly tackling questions.

All questions are available on leetcode.com with some requiring leetcode premium.

Fundamentals

To find the greatest amount of success when practicing, it is highly recommended to know the methods and runtimes of the following data structures and their operations:

  • Arrays
  • Maps
  • Linked Lists
  • Queues
  • Heaps
  • Stacks
  • Trees
  • Graphs

In addition, you should have a good grasp on common algorithms such as:

  • Breadth-first search
  • Depth-first search
  • Binary search
  • Recursion

Notes

This pdf contains information for the main data structures in Java.

Other useful methods to know include substring(), toCharArray(), Math.max(), Math.min(), and Arrays.fill().

Question List

The entire question list can be found here: https://seanprashad.com/leetcode-patterns/.

Solutions

Solutions written in Java can be found in the solutions branch.

Suggestions

Think a question should/shouldn't be included? Wish there was another feature? Feel free to open an issue with your suggestion!

Acknowledgements

This list is heavily inspired from Grokking the Coding Interview with additional problems extracted from the Blind 75 list and this hackernoon article on 14 patterns to ace any coding interview question.

leetcode-patterns's People

Contributors

arnavpuri avatar ddisqq avatar dependabot[bot] avatar edward-noe avatar ganeshjampa avatar gssakash avatar hiromik avatar idsulik avatar ishelar avatar juhitiwari avatar leo-step avatar mm1705 avatar nishantagrawal01 avatar omarfos avatar pavansoundara avatar philiplee13 avatar saqiurila avatar seanprashad avatar shashank5665 avatar shreyshreyansh avatar smith558 avatar stevenlay avatar steviekong avatar td31 avatar thetkpark avatar timurhamitov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leetcode-patterns's Issues

Add introductory studying approach

It'd be great to have a suggested approach when solving questions, including:

  • How long to spend on a never before seen leetcode question
  • Where to go for the solution(s) and how to identify & study the optimal ones
  • How to learn for your own learning style (ie. visual, hands-on etc)

Sort question list by pattern then difficulty

#9 made me realize that the question list only looks 'sorted' since the source file, https://github.com/SeanPrashad/leetcode-patterns/blob/master/src/data/index.js, has the question list conveniently sorted already.

However, this will become a problem when we begin adding new questions that add to existing categories, essentially showing the questions out of place.

Let's look into using react-table's UseSortBy method to implement custom sorting by pattern, then difficulty, then question name.

Resize localStorage array to accomodate for new questions

Currently, if new questions are added here, then any user who visited the site prior to the addition will not be able to use the checkbox to mark off new questions as the array in their local storage won't have indexes for the new questions (ie. it will be short).

We should account for this and update the initialization to handle if the localStorage array already exists and differs in size, then we should create a new array, copy over the old values, and save it over the existing array.

Feature request - Filter questions by company names

Hi, it would be helpful if one could filter questions by clicking on company logo or having a search bar near the company header to search for questions asked by a particular company or a set of companies.

Allow Multiple Patterns for Each Question

Currently, each question is chosen to fit into a specific pattern, even if it might be applicable to other ones (ie. Some tree questions can be completed via DFS/BFS).

Original suggestion: Also, I see that currently there is only one pattern per LC problem, I would suggest we change it to an array and support multiple patterns per problem.

Originally posted by @mm1705 in #7 (comment)

Maintain the Filtering after a Refresh

Preserving the filtering, especially the Companies filtering, after a refresh or when closing the page and opening it again, is a good idea. Recording that information in the cookies seems like an easy fix.

Convert to a template repository

Originally I had intended for this repo to be used solely by myself as I worked through questions over the past summer.

With the repo being open-sourced now, it makes sense to move my solutions to a solutions branch, and convert the repo into a template repository so that others can create their own personal copy tailored to their individual journey.

Update/Add Patterns

As I'm continuing my own studies, I realized that there are some missing categories that would be very helpful, such as:

  • Design
  • Trie
  • Greedy

When adding these new patterns, we should update the existing questions and their respective pattern, if need be, in src/data/index.js.

Ability to hide solved problems

Hi,

First of all wanted to say thank you for collating different patterns of problems. Very helpful.

Now I would really love an ability to hide solved problems, or at-least show a count to user to how many problems he has already solved and how many are remaining.

Thank you.

Two filters do not work together

Following steps to re-create this issue:

  1. Filter problems with any difficulty. (In the screenshot "easy" is selected)
  2. After this, filter out with any company. (Over here "Capital One" is selected)

In the screenshot, one can see it filters out with Capital One and clearly disregard the "easy" difficulty filter. I think UI should either incorporate "smart filtering" - results considering both the filters OR reset the previously selected filter from the screen.

Screen Shot 2021-02-02 at 7 38 23 PM

Add filtering for Questions column

In #72, we combined the Name and Url column into one in order to nicely fit the Solutions column, which linked to Leetcode Discuss.

As a result, filtering capability for the new Question column (ie. the column meant to replace Name and Url) is broken since it's contents are now a custom function and we can't filter by plain text anymore (since it's a hyperlink now).

Add another column for notes

I think we should be able to take notes on each of the problems. Could be stored in local storage just like the check marks

Add Leetcode Discuss

Leetcode discuss is an excellent way to share and view current and previously asked questions by some of the major tech firms!

Let's consider adding this to the docs

Let the user see how many problems has he done

So, there is a total number of questions present there, but I think it would be beneficial if we could also see the number of questions we have done, including the number of easy medium and hard questions number in the list. I think it would be pretty useful feature. Also, if it is approved, I would like to work upon it, too.

Freeze header fields on scroll

Investigate if it is possible to freeze the headers for the table so it's possible to adjust filters when scrolling down the page.

Rename this repository from "lc"

The current repo name, lc, was used as it was short and easy for me to cd into using z .

For better visibility, we should consider renaming from lc to leetcode-patterns, leetcode-study-guide, leetcode-pattern-study-guide, or some other variant that better depicts to users the meaning/usage behind this repo.

Progression Labels on the Top Should Reflect the Filtering

I think progression labels on the top (e.g. Total: 75/170, Easy: 14/36, Medium: 53/102, Hard: 8/32) should be reflecting the list that's present on the screen. This is not something important, but just realized that they were not changing and felt like mentioning it :)

One More Tip to consider

If the problem is to be solved inplace, we will get to the solution either by

  1. swapping the corressponding values.
  2. Storing one or more different values in the same pointer

Company as another filtering criteria for LC questions

Currently, Companies are shown for each problem. If we hover over the icon, the company name is displayed.
How about when we hover over the company icon, we provide an option to click which results in a list of filtered LC questions for the current company?
We may also change Companies to a dropdown like Pattern and Difficulty.

Add Outcome Column to Table

Each question that is found in the list has a specific purpose on what the learning outcome/new technique an individual adds to their own toolkit.

For example, the Subsets question introduces a Backtracking skeleton, which can be almost copy-pasted for other similar questions, like Permutations and Generate Parentheses.

I think it'd be great to have a hidden field that reveals the intended learning outcome when clicked. It could also be a tooltip that displays the optimal time/space complexity in addition to a short blurb about the outcome.

Two different sets of questions on different devices?

Why do I see two different sets of questions on different devices. One of my device shows questions like arrays and stuff early on while my laptop and pc both show questions in this order -


  |   | Contains Duplicate | https://leetcode.com/problems/contains-duplicate/ | Arrays | Easy |  
  |   | Missing Number | https://leetcode.com/problems/missing-number/ | ArraysBit Manipulation | Easy |  
  |   | Find All Numbers Disappeared in an Array | https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ | Arrays | Easy |  
  |   | Single Number | https://leetcode.com/problems/single-number/ | ArraysBit Manipulation | Easy |  
  |   | Climbing Stairs | https://leetcode.com/problems/climbing-stairs/ | Dynamic Programming | Easy |  
  |   | House Robber | https://leetcode.com/problems/house-robber/ | Dynamic Programming | Easy |  
  |   | Best Time to Buy and Sell Stock | https://leetcode.com/problems/best-time-to-buy-and-sell-stock/

DP question starts just at number 5 in this set.

Please Consider Adding a Shuffle Button

Even though there is a "Show/Hide Patterns" slide, it seem that most of the questions are clustered together when they share patterns within a difficulty.

Even though I try not to pay attention to the revealed patterns of the near by questions, I often see them. This gives me a very good hint on how to approach to a problem which I won't have when I will be in an interview.

A shuffle button/slide (some might want to get the original ordering back) would solve that problem since I wouldn't be able to guess the pattern with the ordering randomized.

Option to see patterns

Hey Sean, thank you for the list, it has been really helpful. I was wondering whether it would be possible to add a switch or something at the top to toggle on/off the pattern types for each question. Currently all the pattern types are hidden unless a user clicks check at the left. While hiding the pattern type is definitely useful, I imagine that there are quite a few people who may be trying to find questions for a certain pattern type. Hence the ability to toggle on/off the pattern types would be really useful. Thanks in advance!

Add "Last Solved On" Column

It'd be nice to have a column that would show you when you last solved the question! This could be useful for individuals who want to re-attempt previous questions that gave them trouble (like Backtracking for me)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.