提交 db3aee93 编写于 作者: L luzhipeng

更新readme

上级 fa05b232
......@@ -16,10 +16,26 @@ leetcode 题解,记录自己的 leecode 解题之路。
> 只有熟练掌握基础的数据结构与算法,才能对复杂问题迎刃有余
## 食用说明
## 食用指南
- 经典题目的解析的目录部分,前面有🆕的代表是最新更新的
- 将来会在这里更新anki卡片
- 这里有一份leetcode官方账号在知乎上给出的一个《互联网公司最常见的面试算法题有哪些?》的答案,我这里尽量去覆盖回答中的题目和知识点
原文地址: https://www.zhihu.com/question/24964987/answer/586425979
- 这里有一张互联网公司面试中经常考察的问题类型总结的思维导图,我们可以结合图片中的信息分析一下。
![leetcode-zhihu](./assets//leetcode-zhihu.jpg)
(图片来自leetcode)
其中算法,主要是以下几种:
- 基础技巧:分治、二分、贪心
- 排序算法:快速排序、归并排序、计数排序
- 搜索算法:回溯、递归、深度优先遍历,广度优先遍历,二叉搜索树等
- 图论:最短路径、最小生成树
- 动态规划:背包问题、最长子序列
## 精彩预告
......@@ -111,4 +127,18 @@ TODO
[494.target-sum]
[88.merge-sorted-array]
[139.word-break]
[169.majority-element]
[240.search-a-2-d-matrix-ii]
[416.partition-equal-subset-sum]
[609.find-duplicate-file-in-system]
[887.super-egg-drop]
anki 卡片
/*
* @lc app=leetcode id=169 lang=javascript
*
* [169] Majority Element
*
* https://leetcode.com/problems/majority-element/description/
*
* algorithms
* Easy (51.62%)
* Total Accepted: 365.6K
* Total Submissions: 702.5K
* Testcase Example: '[3,2,3]'
*
* Given an array of size n, find the majority element. The majority element is
* the element that appears more than ⌊ n/2 ⌋ times.
*
* You may assume that the array is non-empty and the majority element always
* exist in the array.
*
* Example 1:
*
*
* Input: [3,2,3]
* Output: 3
*
* Example 2:
*
*
* Input: [2,2,1,1,1,2,2]
* Output: 2
*
*
*/
/**
* @param {number[]} nums
* @return {number}
*/
var majorityElement = function(nums) {
};
/*
* @lc app=leetcode id=240 lang=javascript
*
* [240] Search a 2D Matrix II
*
* https://leetcode.com/problems/search-a-2d-matrix-ii/description/
*
* algorithms
* Medium (40.30%)
* Total Accepted: 170K
* Total Submissions: 419.1K
* Testcase Example: '[[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24],[18,21,23,26,30]]\n5'
*
* Write an efficient algorithm that searches for a value in an m x n matrix.
* This matrix has the following properties:
*
*
* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
*
*
* Example:
*
* Consider the following matrix:
*
*
* [
* ⁠ [1, 4, 7, 11, 15],
* ⁠ [2, 5, 8, 12, 19],
* ⁠ [3, 6, 9, 16, 22],
* ⁠ [10, 13, 14, 17, 24],
* ⁠ [18, 21, 23, 26, 30]
* ]
*
*
* Given target = 5, return true.
*
* Given target = 20, return false.
*
*/
/**
* @param {number[][]} matrix
* @param {number} target
* @return {boolean}
*/
var searchMatrix = function(matrix, target) {
};
/*
* @lc app=leetcode id=301 lang=javascript
*
* [301] Remove Invalid Parentheses
*
* https://leetcode.com/problems/remove-invalid-parentheses/description/
*
* algorithms
* Hard (38.52%)
* Total Accepted: 114.3K
* Total Submissions: 295.4K
* Testcase Example: '"()())()"'
*
* Remove the minimum number of invalid parentheses in order to make the input
* string valid. Return all possible results.
*
* Note: The input string may contain letters other than the parentheses ( and
* ).
*
* Example 1:
*
*
* Input: "()())()"
* Output: ["()()()", "(())()"]
*
*
* Example 2:
*
*
* Input: "(a)())()"
* Output: ["(a)()()", "(a())()"]
*
*
* Example 3:
*
*
* Input: ")("
* Output: [""]
*
*/
/**
* @param {string} s
* @return {string[]}
*/
var removeInvalidParentheses = function(s) {
};
/*
* @lc app=leetcode id=88 lang=javascript
*
* [88] Merge Sorted Array
*
* https://leetcode.com/problems/merge-sorted-array/description/
*
* algorithms
* Easy (34.95%)
* Total Accepted: 347.5K
* Total Submissions: 984.7K
* Testcase Example: '[1,2,3,0,0,0]\n3\n[2,5,6]\n3'
*
* Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as
* one sorted array.
*
* Note:
*
*
* The number of elements initialized in nums1 and nums2 are m and n
* respectively.
* You may assume that nums1 has enough space (size that is greater or equal to
* m + n) to hold additional elements from nums2.
*
*
* Example:
*
*
* Input:
* nums1 = [1,2,3,0,0,0], m = 3
* nums2 = [2,5,6], n = 3
*
* Output: [1,2,2,3,5,6]
*
*
*/
/**
* @param {number[]} nums1
* @param {number} m
* @param {number[]} nums2
* @param {number} n
* @return {void} Do not return anything, modify nums1 in-place instead.
*/
var merge = function(nums1, m, nums2, n) {
};
/*
* @lc app=leetcode id=887 lang=javascript
*
* [887] Super Egg Drop
*
* https://leetcode.com/problems/super-egg-drop/description/
*
* algorithms
* Hard (24.64%)
* Total Accepted: 6.2K
* Total Submissions: 24.9K
* Testcase Example: '1\n2'
*
* You are given K eggs, and you have access to a building with N floors from 1
* to N. 
*
* Each egg is identical in function, and if an egg breaks, you cannot drop it
* again.
*
* You know that there exists a floor F with 0 <= F <= N such that any egg
* dropped at a floor higher than F will break, and any egg dropped at or below
* floor F will not break.
*
* Each move, you may take an egg (if you have an unbroken one) and drop it
* from any floor X (with 1 <= X <= N). 
*
* Your goal is to know with certainty what the value of F is.
*
* What is the minimum number of moves that you need to know with certainty
* what F is, regardless of the initial value of F?
*
*
*
*
*
*
*
* Example 1:
*
*
* Input: K = 1, N = 2
* Output: 2
* Explanation:
* Drop the egg from floor 1. If it breaks, we know with certainty that F = 0.
* Otherwise, drop the egg from floor 2. If it breaks, we know with certainty
* that F = 1.
* If it didn't break, then we know with certainty F = 2.
* Hence, we needed 2 moves in the worst case to know what F is with
* certainty.
*
*
*
* Example 2:
*
*
* Input: K = 2, N = 6
* Output: 3
*
*
*
* Example 3:
*
*
* Input: K = 3, N = 14
* Output: 4
*
*
*
*
* Note:
*
*
* 1 <= K <= 100
* 1 <= N <= 10000
*
*
*
*
*
*/
/**
* @param {number} K
* @param {number} N
* @return {number}
*/
var superEggDrop = function(K, N) {
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册