Zeonho / LeetCode_Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leetcode pratice repo

this repo records my pratice of leetcode questions.

Getting Started

This project contains a make file script written in python that helps to download and create local file directly from leetcode.com

Prerequisites

The python script requires is run on python3, and require pypi and selenium chrome driver used for automatically download question and description from the website.

python3 --version
pip3 --version

Installing

Pip

for Mac OS

brew install python3
pip3 --version

Or Ubuntu 18.04

sudo apt update
sudo apt install python3-pip
pip3 --version

beatifulSoup

sudo apt-get install python3-bs4

or

pip3 install bs4

Selenium

pip3 install selenium

Web Drivers

Selenium requires a driver to interface with the chosen browser. Firefox, for example, requires geckodriver, which needs to be installed before the below examples can be run. Make sure it’s in your PATH, e. g., place it in /usr/bin or /usr/local/bin.

https://sites.google.com/a/chromium.org/chromedriver/downloads

Usage

python3 make.py "question_url"
python3 make.py "question number"

Next Revision:

  • Provide option for entering question number or question url
  • Seperate project

Top Interview Questions

In the first round of going through the questions, i did on about 200 questions randomly. For the second round, i am planning to solving the problem by topics.

  • Array
  • Strings
  • Linked List
  • Trees
  • Sorting and Searching
  • Dynamic Programming
  • Design
  • Math
  • Others
Array Questions Methods Complexity
X Remove Duplicates from Sorted Array Two Pointers Time: O(n); Space: O(1)

About


Languages

Language:Python 95.8%Language:C++ 2.0%Language:C 1.2%Language:Java 1.1%