Skip to content

polossk/LeetCode-OJ-Solution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode OJ Solution

CC-BY-NC-SA-4.0 leetcode.com leetcode-cn.com

Progress // 当前进度

LeetCode# CCI* COF**
Total 1444 (8) 109 75
Easy 53 (2) 2 2
Medium 95 (3) 2 2
Hard 26 (0) 1 1
Solved 174 (5) 5 5
  • # Some problems are locked by leetcode. The number in brackets is solved. // 部分题目被锁,括号内是其数目
  • * CCI is the abbreviation of "Cracking the Coding Interview", here is the portal // CCI 是《程序员面试金典》的题库,传送链接已附上
  • ** COF is the abbreviation of "Coding Interviews: Questions, Analysis and Solutions", here is the portal // COF 是《剑指 Offer(第 2 版)》的题库,传送链接已附上

Solutions // 刷题成果

  • LeetCode (Total): cpp
    python ruby java haskell

  • LeetCode Locked Problems: cpp python ruby

  • CCI: cpp

  • COF: cpp

  • Unreleased: None

  • The C++ solution is currently the way I work through the Leetcode // 我现在主要用 C++ 刷题

  • Haskell solution is just for fun :) // 偶尔也会用 Haskell 水一些题

  • The Archive Unreleased is for some problem somehow it shows up for practicing but does not list up in the problem set. It is rare to find one, and it will be moved into the problem set after its release.

Solved Problem List // 题目列表

Archive AC/TTL Archive AC/TTL Archive AC/TTL Archive AC/TTL
0 52 1 29 2 24/99(0/1) 3 13/99(0/1)
4 10/99(0/1) 5 7 6 3 7 6
8 6 9 5 10 7 11 4
12 2 13 0 14 1/95(5/5)
  • Each Archive contains 100 problems.
  • several questions were locked, pattern a/b (c/d) means that accepted a problems within b problems, moveover, accepted c locked problems within d problems.

Archive#00: Problem 001 ~ Problem 100

ID Difficulty Problem cpp python ruby java
001 Easy Two Sum
002 Medium Add Two Numbers
003 Medium Longest Substring Without Repeating Characters
004 Hard Median of Two Sorted Arrays
005 Medium Longest Palindromic Substring
006 Hard ZigZag Conversion
007 Easy Reverse Integer
008 Medium String to Integer (atoi)
009 Easy Palindrome Number
010 Hard Regular Expression Matching
011 Medium Container With Most Water
012 Medium Integer to Roman
013 Easy Roman to Integer
014 Easy Longest Common Prefix
015 Medium 3Sum
016 Medium 3Sum Closest
017 Medium Letter Combinations of a Phone Number
019 Medium Remove Nth Node From End of List
020 Easy Valid Parentheses
021 Easy Merge Two Sorted Lists
022 Medium Valid Parentheses
023 Hard Merge k Sorted Lists
024 Medium Swap Nodes in Pairs
025 Hard Reverse Nodes in k-Group
029 Medium Divide Two Integers
031 Medium Next Permutation
032 Hard Longest Valid Parentheses
033 Medium Search in Rotated Sorted Array
039 Medium Combination Sum
042 Hard Trapping Rain Water
044 Hard Wildcard Matching
045 Hard Jump Game II
046 Medium Permutations
049 Medium Group Anagrams
050 Medium Pow(x, n)
053 Easy Maximum Subarray
055 Medium Jump Game
056 Medium Merge Intervals
061 Medium Rotate List
064 Medium Minimum Path Sum
065 Hard Valid Number
068 Hard Text Justification
069 Easy Sqrt(x)
072 Hard Edit Distance
074 Medium Search a 2D Matrix
081 Medium Search in Rotated Sorted Array II
082 Medium Remove Duplicates from Sorted List II
083 Easy Remove Duplicates from Sorted List
086 Medium Partition List
091 Medium Decode Ways
093 Medium Restore IP Addresses
098 Medium Validate Binary Search Tree
100

Archive#01: Problem 101 ~ Problem 200

ID Difficulty Problem cpp python ruby java
104 Easy Maximum Depth of Binary Tree
121 Easy Best Time to Buy and Sell Stock
122 Easy Best Time to Buy and Sell Stock II
123 Hard Best Time to Buy and Sell Stock III
124 Hard Binary Tree Maximum Path Sum
125 Easy Valid Palindrome
126 Hard Word Ladder II
127 Medium Word Ladder
130 Medium Surrounded Regions
133 Medium Clone Graph
136 Easy Single Number
137 Medium Single Number II
139 Medium Word Break
141 Easy Linked List Cycle
142 Medium Linked List Cycle II
143 Medium Reorder List
146 Medium Evaluate Reverse Polish Notation
149 Hard Max Points on a Line
150 Medium Evaluate Reverse Polish Notation
151 Medium Reverse Words in a String
152 Easy Maximum Subarray
155 Medium Min Stack
165 Medium Compare Version Numbers
166 Medium Fraction to Recurring Decimal
169 Easy Majority Element
188 Hard Best Time to Buy and Sell Stock IV
189 Easy Rotate Array
199 Medium Binary Tree Right Side View
200 Medium Number of Islands

Archive#02: Problem 201 ~ Problem 300

ID Difficulty Problem cpp python ruby java
201 Medium Bitwise AND of Numbers Range
202 Easy Happy Number
204 Easy Count Primes
208 Medium Implement Trie (Prefix Tree)
211 Medium Add and Search Word - Data structure design
218 Hard The Skyline Problem
220 Medium Contains Duplicate III
221 Medium Maximal Square
224 Hard Basic Calculator
225 Easy Implement Stack using Queues
226 Easy Invert Binary Tree
227 Medium Basic Calculator II
231 Easy Power of Two
235 Easy Lowest Common Ancestor of a Binary Search Tree
236 Medium Lowest Common Ancestor of a Binary Tree
238 Medium Product of Array Except Self
241 Medium Different Ways to Add Parentheses
260 Medium Single Number III
273 Hard Integer to English Words
278 Easy First Bad Version
279 Medium Perfect Squares
283 Easy Move Zeroes
289 Medium Game of Life
300 Medium Longest Increasing Subsequence

Archive#03: Problem 301 ~ Problem 400

ID Difficulty Problem cpp python ruby java
306 Medium Additive Number
307 Medium Range Sum Query - Mutable
309 Medium Best Time to Buy and Sell Stock with Cooldown
315 Hard Count of Smaller Numbers After Self
318 Medium Maximum Product of Word Lengths
327 Hard Count of Range Sum
355 Medium Design Twitter
365 Medium Water and Jug Problem
367 Easy Valid Perfect Square
383 Easy Ransom Note
385 Medium Mini Parser
387 Easy First Unique Character in a String
394 Medium Decode String
400

Archive#04: Problem 401 ~ Problem 500

ID Difficulty Problem cpp python ruby java
409 Easy Longest Palindrome
415 Easy Add Strings
420 Hard Strong Password Checker
445 Medium Add Two Numbers II
464 Medium Can I Win
466 Hard Count The Repetitions
468 Medium Validate IP Address
476 Easy Number Complement
493 Hard Reverse Pairs
494 Medium Target Sum
500

Archive#05: Problem 501 ~ Problem 600

ID Difficulty Problem cpp python ruby java
525 Medium Contiguous Array
540 Medium Single Element in a Sorted Array
541 Easy Reverse String II
542 Medium 01 Matrix
543 Easy Diameter of Binary Tree
560 Medium Subarray Sum Equals K
572 Easy Subtree of Another Tree
600

Archive#06: Problem 601 ~ Problem 700

ID Difficulty Problem cpp python ruby java
622 Medium Design Circular Queue
678 Medium Valid Parenthesis String
695 Medium Max Area of Island
700

Archive#07: Problem 701 ~ Problem 800

ID Difficulty Problem cpp python ruby java
714 Medium Best Time to Buy and Sell Stock with Transaction Fee
733 Easy Flood Fill
735 Medium Asteroid Collision
739 Medium Daily Temperatures
752 Medium Open the Lock
771 Easy Jewels and Stones
800

Archive#08: Problem 801 ~ Problem 900

ID Difficulty Problem cpp python ruby java
820 Medium Short Encoding of Words
836 Easy Rectangle Overlap
844 Easy Backspace String Compare
876 Easy Middle of the Linked List
887 Easy Super Egg Drop
892 Easy Surface Area of 3D Shapes
900

Archive#09: Problem 901 ~ Problem 1000

ID Difficulty Problem cpp python ruby java
912 Medium Sort an Array
945 Medium Minimum Increment to Make Array Unique
983 Medium Minimum Cost For Tickets
993 Easy Cousins in Binary Tree
997 Easy Find the Town Judge
1000

Archive#10: Problem 1001 ~ Problem 1100

ID Difficulty Problem cpp python ruby java
1008 Medium Construct Binary Search Tree from Preorder Traversal
1009 Easy Complement of Base 10 Integer
1013 Easy Partition Array Into Three Parts With Equal Sum
1046 Easy Last Stone Weight
1049 Medium Last Stone Weight II
1071 Easy Greatest Common Divisor of Strings
1095 Hard Find in Mountain Array
1100

Archive#11: Problem 1101 ~ Problem 1200

ID Difficulty Problem cpp python ruby java
1111 Medium Maximum Nesting Depth of Two Valid Parentheses Strings
1143 Medium Longest Common Subsequence
1160 Easy Find Words That Can Be Formed by Characters
1162 Medium As Far from Land as Possible
1200

Archive#12: Problem 1201 ~ Problem 1300

ID Difficulty Problem cpp python ruby java
1232 Easy Check If It Is a Straight Line
1248 Medium Count Number of Nice Subarrays
1300

Archive#13: Problem 1301 ~ Problem 1400

ID Difficulty Problem cpp python ruby java
1400

Archive#14: Problem 1401 ~ Problem 1500

ID Difficulty Problem cpp python ruby java
1415 Medium The k-th Lexicographical String of All Happy Strings of Length n
1426 Easy Counting Elements
1427 Easy Perform String Shifts
1428 Medium Leftmost Column with at Least a One
1429 Medium First Unique Number
1430 Medium Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree
1500

Locked LeetCode Problems (8)

  • Solved
    • 1426 - Counting Elements
    • 1427 - Perform String Shifts
    • 1428 - Leftmost Column with at Least a One
    • 1429 - First Unique Number
    • 1430 - Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree
  • Finded but without permission
    • 288 - Unique Word Abbreviation
    • 308 - Range Sum Query 2D - Mutable
    • 444 - Sequence Reconstruction

Archive#CCI

ID Difficulty Problem cpp python ruby java
面试题 01.06 Easy 字符串压缩
面试题 01.07 Medium 旋转矩阵
面试题 08.11 Medium 硬币
面试题 16.03 Hard 交点
面试题 17.16 Easy 按摩师

Archive#COF

ID Difficulty Problem cpp python ruby java
面试题 13 Medium 机器人的运动范围
面试题 40 Easy 最小的 k 个数
面试题 51 Hard 数组中的逆序对
面试题 56-I Medium 数组中数字出现的次数
面试题 62 Easy 圆圈中最后剩下的数字

Tags // 标签分类

Programming Fundamentals // 编程基础

Algorithm // 算法

Data Structure // 数据结构

Math, Arithmetic, Game Theory // 数学相关

High-level Programming Techniques // 编程技巧

Un-taged (by LeetCode)

Several questions were not attaching any tags by the LeetCode. So I mark them with my tags (green colored) for looking them over. It may be a thinking way, a concept, a programming technique, or a data structure. // 部分题目并没有给出官方的标签,所以我自作主张给了一份绿色标签,包括思维方式、概念、编程技巧或特殊数据结构。

License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

About

simple solution for leetcode

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published