Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/charmve/leetcode4flag

🔥 🔥 High frequent interview LeetCode 100 for FaceBook,Linkedin,Amazon,Google,Microsoft. More importantly, the problems' solutions are provided,include C++, Python and Java.
https://github.com/charmve/leetcode4flag

amazon bytedance coding coding-challenge coding-interviews cpp facebook google google-interview interview interview-preparation interview-questions java jobs leetcode leetcode-solutions lintcode lintcode-solutions microsoft offer

Last synced: 3 months ago
JSON representation

🔥 🔥 High frequent interview LeetCode 100 for FaceBook,Linkedin,Amazon,Google,Microsoft. More importantly, the problems' solutions are provided,include C++, Python and Java.

Awesome Lists containing this project

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


Buy Me A Coffee

## 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


✅ AC






Amazon


Easy

✂️ 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






Medium


⛺ 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






Hard


⛺ 297. Serialize and Deserialize Binary Tree


:shipit: C++ |
🐍 Python |
♨️ Java






🌈 240. Search a 2D Matrix II


:shipit: C++ |
🐍 Python |
♨️ Java









Google


Easy

🚠 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






Medium


⛵ 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






Hard


⛺ 173. Binary Search Tree Iterator


:shipit: C++ |
🐍 Python |
♨️ Java






🌈 239. Sliding Window Maximum


:shipit: C++ |
🐍 Python |
♨️ Java









FaceBook


Easy

🚠 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






Medium


🚩 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






Hard


🎄 126. Word Ladder II


:shipit: C++ |
🐍 Python |
♨️ Java






🎑 85. Maximal Rectangle


:shipit: C++ |
🐍 Python |
♨️ Java









LinkedIn


Easy

🎏 152. Maximum Product Subarray


:shipit: C++ |
🐍 Python |
♨️ Java






🍋 678. Valid Parenthesis String


:shipit: C++ |
🐍 Python |
♨️ Java






Medium


⛵ 245. Shortest Word Distance III


:shipit: C++ |
🐍 Python |
♨️ Java






🚁 178. Rank Scores


:shipit: C++ |
🐍 Python |
♨️ Java






Hard


⛺ 173. Binary Search Tree Iterator


:shipit: C++ |
🐍 Python |
♨️ Java






🌈 239. Sliding Window Maximum


:shipit: C++ |
🐍 Python |
♨️ Java









MicroSoft


Easy


🎑 215. Kth Largest Element in an Array



:shipit: C++ |
🐍 Python |
♨️ Java






🍋 678. Valid Parenthesis String


:shipit: C++ |
🐍 Python |
♨️ Java






Medium


⛵ 236. Lowest Common Ancestor of a Binary Tree


:shipit: C++ |
🐍 Python |
♨️ Java






🚁 剑指 Offer 51. 数组中的逆序对


:shipit: C++ |
🐍 Python |
♨️ Java






Hard


⛺ 99. Recover Binary Search Tree


:shipit: C++ |
🐍 Python |
♨️ Java






🌈 239. Sliding Window Maximum


:shipit: C++ |
🐍 Python |
♨️ Java





[Index](#index)

Buy Me A Coffee


## Classification



Algorithm


LeetCode Link


Level


Code


✅ AC




Dynamic Programming
动态规划


--> 解题模板


⛺ 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








Divide & Conquer
分治思想


--> 解题模板

✂️ 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








Dichotomy
二分法


--> 解题模板

✂️ 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








Recursion
递归


--> 解题模板

✂️ 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








Sorting Algorithm
排序算法


--> 解题模板

✂️ 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








Traverse/Visit
遍历


--> 解题模板

✂️ 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








Dual Pointer Algorithm
双指针算法


--> 解题模板

✂️ 剑指 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








Breadth First Search
宽度/广度优先搜索


--> 解题模板

✂️ 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








Depth First Search
深度优先搜索


--> 解题模板

✂️ 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)

## :rocket: 知识星球

专为求职面试中算法与数据结构的小伙伴,创了学习交流/刷题群(知识星球)!想要最快的提升算法与数据结构技能,和更多小伙伴一起来吧!进阶面试八股文,大厂面经



Click to see the more details



Click to see the more details

## 💖 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.