文件名称:leetcode答案-LeetCode:不要放弃
文件大小:88KB
文件格式:ZIP
更新时间:2024-07-19 18:40:50
系统开源
leetcode 答案LeetCode 算法的复杂度分析。排序算法,以及他们的区别和优化。数组中的双指针、滑动窗口思想。利用Map 和Set 处理查找表问题。链表的各种问题。利用递归和迭代法解决二叉树问题。栈、队列、DFS、BFS。回溯法、贪心算法、动态规划。 Backtracking (回溯法) 递回求解,通常用于需暴力找出所有排列组合,但又需排除掉某些不正确的组合时使用,通常会有三个主要部分: 递回函式的符合条件 当结果符合时,储存或输出答案,并跳离递回。 递回函式的参数 一定会有一个result用于储存当前的组合,后面会夹带1 ~ N个参数,用于暂存当前递回的状况,例如backtracking(current, level) , backtracking(current, left, right) 递回逻辑 在未满足符合条件时,要继续调整参数并且回溯下去,直到找到答案为止。 Example 因为是递回求解,所以很抽象不好懂,这里以leetcode的generate-parentheses一道题目为例,给定n,要找出n个括号的各种组合,例如n=2 ,答案会是[(()), ()()]
【文件预览】:
LeetCode-master
----.gitignore(8B)
----problems()
--------longest-word-in-dictionary.js(3KB)
--------remove-duplicates-from-sorted-array.js(2KB)
--------intersection-of-two-arrays.js(4KB)
--------increasing-decreasing-string.js(3KB)
--------long-pressed-name.js(3KB)
--------range-sum-of-bst.js(2KB)
--------maximum-depth-of-binary-tree.js(2KB)
--------reverse-string.js(896B)
--------sort-array-by-parity-II.js(2KB)
--------intersection-of-two-arrays-II.js(2KB)
--------linked-list-cycle.js(2KB)
--------intersection-of-two-linked-lists.js(3KB)
--------best-time-to-buy-and-sell-stock.js(1KB)
--------palindrome-linked-list.js(1KB)
--------minimum-depth-of-binary-tree.js(2KB)
--------jewels-and-stones.js(1KB)
--------merge-sorted-array.js(1KB)
--------two-sum-II-input-array-is-sorted.js(1KB)
--------find-the-difference.js(3KB)
--------path-sum.js(2KB)
--------array-partition-I.js(892B)
--------backspace-string-compare.js(3KB)
--------balanced-binary-tree.js(2KB)
--------how-many-numbers-are-smaller-than-the-current-number.js(1KB)
--------palindrome-number.js(979B)
--------merge-two-sorted-lists.js(2KB)
--------first-unique-character-in-a-string.js(852B)
--------employee-importance.js(2KB)
--------crawler-log-folder.js(2KB)
--------same-tree.js(3KB)
--------convert-binary-number-in-a-linked-list-to-Integer.js(6KB)
--------uncommon-words-from-two-sentences.js(1KB)
--------sqrt(x).js(718B)
--------plus-one.js(1KB)
--------delete-node-in-a-linked-list.js(2KB)
--------majority-element.js(1KB)
--------reverse-linked-list.js(1KB)
--------roman-to-integer.js(2KB)
--------sum-of-unique-elements.js(1KB)
--------count-and-say.js(2KB)
--------string-compression.js(3KB)
--------keyboard-row.js(2KB)
--------single-number.js(798B)
--------remove-duplicates-from-sorted-list.js(2KB)
--------binary-tree-tilt.js(3KB)
--------remove-linked-list-elements.js(2KB)
--------increasing-order-search-tree.js(2KB)
--------subdomain-visit-count.js(3KB)
--------N-repeated-element-in-size-2N-array.js(928B)
--------valid-palindrome.js(973B)
--------remove-element.js(3KB)
--------binary-tree-path.js(1KB)
--------generate-parentheses.js(1019B)
--------relative-sort-array.js(2KB)
--------middle-of-the-linked-list.js(2KB)
--------maximum-subarray.js(1KB)
--------leaf-similar-trees.js(4KB)
--------find-common-characters.js(2KB)
--------move-zeroes.js(3KB)
--------convert-sorted-array-to-binary-search-tree.js(2KB)
--------search-insert-position.js(1KB)
--------reverse-vowels-of-a-string.js(1KB)
--------valid-parentheses.js(2KB)
--------squares-of-a-sorted-array.js(2KB)
--------contains-duplicate-II.js(981B)
--------longest-palindrome.js(1KB)
--------climbing-stairs.js(944B)
--------two-sum.js(1013B)
--------contains-duplicate.js(1KB)
--------maximum-number-of-balloons.js(1KB)
--------valid-anagram.js(1KB)
--------happy-number.js(1KB)
--------design-hashMap.js(2KB)
--------implement-strStr.js(890B)
--------find-words-that-can-be-formed-by-characters.js(3KB)
----utils.js(345B)
----README.md(3KB)
----prettier.config.js(78B)
----.vscode()
--------settings.json(121B)
----data-structure.js(62KB)
----.editorconfig(147B)