# LeetCode4FLAG **Repository Path**: repe/LeetCode4FLAG ## Basic Information - **Project Name**: LeetCode4FLAG - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-16 - **Last Updated**: 2021-12-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

LeetCode4FLAG  

🌍 English | [简体中文](README-zh_CN.md)| [日本語](README-jp_JP.md) | [Українською](README-uk_UA.md)


CircleCI Version No. Code License Chinese Version

High frequent interview LeetCode test for FaceBook, Linkedin, Amazon, Google. More importantly, the problems' solutions are provided in C/C++, Python and Java. Offer, Offer, Offer !

高频合集答题模板打卡群📕 Docs

---- Note: Please raise an issue for any suggestions, corrections, and feedback. - [2020年最新FLAMG面试频率最高的127道题.xlsx](https://github.com/Charmve/LeetCode4FLAG/raw/main/2020最新-FLAMG面试频率最高的127道题.xlsx) - [Google最常考的40道动态规划题.xlsx](https://github.com/Charmve/LeetCode4FLAG/raw/main/Google最常考的40道动态规划题.xlsx) - [FaceBook高频题100道.xlsx](https://github.com/Charmve/LeetCode4FLAG/raw/main/Facebook高频题100道.xls) - CodeTop持续更新 https://codetop.cc/home
## Index - 🔥 [Top100](#top100) - 💠 [Classification](#classification) - 📕 [算法思维+算法模板](#算法思维算法模板) - :open_file_folder: [面经C++/后端/算法](https://blog.csdn.net/charmve/category_9622929.html) - 👥 [Community](#community) - :sparkling_heart: [Support](#-support-this-project)
## Top100
Company Level LeetCode Link Code Clock in
✂️ 74. Search a 2D Matrix
:shipit: C++ | 🐍 Python | ♨️ Java
2021-09-30
🐼 1. Two Sum
:shipit: C++ | 🐍 Python | ♨️ Java
📈 21. Merge Two Sorted Lists
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 107. Binary Tree Level Order Traversal II
:shipit: C++ | 🐍 Python | ♨️ Java
👑 32. Longest Valid Parentheses
:shipit: C++ | 🐍 Python | ♨️ Java
🎡 20. Valid Parentheses
:shipit: C++ | 🐍 Python | ♨️ Java
🌄 200. Number of Islands
:shipit: C++ | 🐍 Python | ♨️ Java
🐋 202. Happy Number
:shipit: C++ | 🐍 Python | ♨️ Java
🐑 1120. Maximum Average Subtree
:shipit: C++ | 🐍 Python | ♨️ Java
🐧 543. Diameter of Binary Tree
:shipit: C++ | 🐍 Python | ♨️ Java
⛺ 297. Serialize and Deserialize Binary Tree
:shipit: C++ | 🐍 Python | ♨️ Java
🌈 240. Search a 2D Matrix II
:shipit: C++ | 🐍 Python | ♨️ Java
🚀 124. Binary Tree Maximum Path Sum
:shipit: C++ | 🐍 Python | ♨️ Java
⛺ 297. Serialize and Deserialize Binary Tree
:shipit: C++ | 🐍 Python | ♨️ Java
🌈 240. Search a 2D Matrix II
:shipit: C++ | 🐍 Python | ♨️ Java
🚠 94. Binary Tree Inorder Traversal
:shipit: C++ | 🐍 Python | ♨️ Java
⛵ 863. All Nodes Distance K in Binary Tree
:shipit: C++ | 🐍 Python | ♨️ Java
📈 21. Merge Two Sorted Lists
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 107. Binary Tree Level Order Traversal II
:shipit: C++ | 🐍 Python | ♨️ Java
👑 32. Longest Valid Parentheses
:shipit: C++ | 🐍 Python | ♨️ Java
🎡 20. Valid Parentheses
:shipit: C++ | 🐍 Python | ♨️ Java
🌄 200. Number of Islands
:shipit: C++ | 🐍 Python | ♨️ Java
🐋 202. Happy Number
:shipit: C++ | 🐍 Python | ♨️ Java
🐑 1120. Maximum Average Subtree
:shipit: C++ | 🐍 Python | ♨️ Java
🐏 543. Diameter of Binary Tree
:shipit: C++ | 🐍 Python | ♨️ Java
⛵ 494. Target Sum
:shipit: C++ | 🐍 Python | ♨️ Java
🚁 938. Range Sum of BST
:shipit: C++ | 🐍 Python | ♨️ Java
🚀 124. Binary Tree Maximum Path Sum
:shipit: C++ | 🐍 Python | ♨️ Java
⛺ 173. Binary Search Tree Iterator
:shipit: C++ | 🐍 Python | ♨️ Java
🌈 239. Sliding Window Maximum
:shipit: C++ | 🐍 Python | ♨️ Java
🚠 833. Find And Replace in String
:shipit: C++ | 🐍 Python | ♨️ Java
🌄 200. Number of Islands
:shipit: C++ | 🐍 Python | ♨️ Java
🐠 67. Add Binary
:shipit: C++ | 🐍 Python | ♨️ Java
🚩 90. Subsets II
:shipit: C++ | 🐍 Python | ♨️ Java
🍐 17. Letter Combinations of a Phone Number
:shipit: C++ | 🐍 Python | ♨️ Java
🚁 525. Contiguous Array
:shipit: C++ | 🐍 Python | ♨️ Java
🎄 126. Word Ladder II
:shipit: C++ | 🐍 Python | ♨️ Java
🎑 85. Maximal Rectangle
:shipit: C++ | 🐍 Python | ♨️ Java
🎏 152. Maximum Product Subarray
:shipit: C++ | 🐍 Python | ♨️ Java
🍋 678. Valid Parenthesis String
:shipit: C++ | 🐍 Python | ♨️ Java
⛵ 245. Shortest Word Distance III
:shipit: C++ | 🐍 Python | ♨️ Java
🚁 178. Rank Scores
:shipit: C++ | 🐍 Python | ♨️ Java
⛺ 173. Binary Search Tree Iterator
:shipit: C++ | 🐍 Python | ♨️ Java
🌈 239. Sliding Window Maximum
:shipit: C++ | 🐍 Python | ♨️ Java
🎑 215. Kth Largest Element in an Array
:shipit: C++ | 🐍 Python | ♨️ Java
🍋 678. Valid Parenthesis String
:shipit: C++ | 🐍 Python | ♨️ Java
⛵ 236. Lowest Common Ancestor of a Binary Tree
:shipit: C++ | 🐍 Python | ♨️ Java
🚁 剑指 Offer 51. 数组中的逆序对
:shipit: C++ | 🐍 Python | ♨️ Java
⛺ 99. Recover Binary Search Tree
:shipit: C++ | 🐍 Python | ♨️ Java
🌈 239. Sliding Window Maximum
:shipit: C++ | 🐍 Python | ♨️ Java

[Index](#index)
## Classification
Algorithm LeetCode Link Level Code Clock in
⛺ 568. Maximum Vacation Days ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🌈 70. Climbing Stairs ⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🚀 10. Regular Expression Matching ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
⛺ 198. House Robber ⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🌈 139. Word Break ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🎏 152. Maximum Product Subarray ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🌈 91. Decode Ways ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 72. Edit Distance ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 4. Median of Two Sorted Arrays ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 23. Merge k Sorted Lists ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 110. Balanced Binary Tree ⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🚀 124. Binary Tree Maximum Path Sum ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 98. Validate Binary Search Tree ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 153. Find Minimum in Rotated Sorted Array ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 33. Search in Rotated Sorted Array ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 69. Sqrt(x) ⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 29. Divide Two Integers ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 162. Find Peak Element ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 22. 括号生成 ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 89. 格雷编码 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 110. 平衡二叉树 ⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 17. 电话号码的字母组合 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 46. 全排列 ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 124. 二叉树中的最大路径和 ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 215. 数组中的第K个最大元素 ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 LintCode. 无序数组K小元素 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 629. K个逆序对数组 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 剑指 Offer 51. 数组中的逆序对 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 327. 区间和的个数 ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 LintCode 399.Nuts & Bolts Problem-Nuts 和 Bolts 的问题 ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 899. 有序队列 ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 376. 摆动序列 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 123. 买卖股票的最佳时机 III ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 644. 最大子段和 II ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 102. 二叉树的层序遍历 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 144. 二叉树的前序遍历 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 145. 二叉树的后序遍历 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 987. 二叉树的垂序遍历 ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 257. 二叉树的所有路径 ⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 剑指 Offer 48. 最长不含重复字符的子字符串 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 11. 盛最多水的容器 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 42. 接雨水 ⭐⭐⭐ #双指针-two-pointers
:shipit: C++ | 🐍 Python | ♨️ Java
📈 647. 回文子串 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 92. 反转链表 II ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 142. 环形链表 II ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 127. 单词接龙 ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 200. 岛屿数量 ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 102. 二叉树的层序遍历 ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 133. 克隆图 ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 107. 二叉树的层序遍历 II ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 199. 二叉树的右视图 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
✂️ 111. 二叉树的最小深度 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🐼 面试题 05.01. 插入 ⭐⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 126. 单词接龙 II ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 131. 分割回文串 ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
📈 51. N 皇后 ⭐⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java
🔎 107. Binary Tree Level Order Traversal II ⭐⭐⭐
:shipit: C++ | 🐍 Python | ♨️ Java

[Index](#index)
# 算法思维+[算法模板](./题解模板.md) ## 回溯 ``` result = [] def backtrack(路径, 选择列表): if 满足结束条件: result.add(路径) return for 选择 in 选择列表: 做选择 backtrack(路径, 选择列表) 撤销选择 ```
LeetCode 22. Generate Parentheses https://leetcode-cn.com/problems/generate-parentheses/
Given ``n`` pairs of parentheses, write a function to generate all combinations of well-formed parentheses. **Example 1:** ``` Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] ``` **Example 2:** ``` Input: n = 1 Output: ["()"] ``` **Constraints:** ``1 <= n <= 8``
``` void backtrack(int n, int i, string& track) { // i 代表当前的位置,共 2n 个位置 // 穷举到最后一个位置了,得到一个长度为 2n 组合 if (i == 2 * n) { print(track); return; } // 对于每个位置可以是左括号或者右括号两种选择 for choice in ['(', ')'] { track.push(choice); // 做选择 // 穷举下一个位置 backtrack(n, i + 1, track); track.pop(choice); // 撤销选择 } } ``` See more -> [题解模板.md](./题解模板.md)
[Index](#index)
# Community - We have a discord server! [![Discord](https://img.shields.io/discord/744385009028431943.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/9BBt5BndMx) This should be your first stop to talk with other Coding friends. Why don't you introduce yourself right now? [Join the Coding channel in LeetCode4FLAG Discord](https://discord.gg/9BBt5BndMx) - You can also interact through [GitHub issues](https://github.com/Charmve/LeetCode4FLAG/issues). If there is any problem, or a change needs to be made to the repo, this is the place to start the conversation. Read more [here](CONTRIBUTING.md). - Subscribe to our [Offical Account with WeChat](https://github.com/Charmve/PaperWeeklyAI/blob/master/MaiweiAI-com.png?raw=true).
[Index](#index)
# License 知识共享许可协议
[Index](#index)
## 💖 Support this project Donating to help me continue working on this project. BuymeaCoffee Buy Me A Coffee Donate with Paypal     Donate with AliPay | Donate with WeChat

2021 © Charmve.