Algorithm LeetCode

22. 括号生成

https://leetcode.cn/problems/generate-parentheses/description 数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合。 示例 1: 输入:n = 3 输出:[“((()))”,”(()())”,”(())()”,”()(())”,”()()()”] 示例 2: 输入:n = 1 输出:[“()”] 提示: 1 <= n <= 8…

Read More
LeetCode Logo

Subscribe to Our Latest Articles

Submit to receive awesome articles in your email inbox.

Tech Reviews

LeetCode Logo
AlgorithmLeetCode
22. 括号生成

https://leetcode.cn/problems/generate-parentheses/description 数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合。 示例 1: 输入:n = 3 输出:[“((()))”,”(()())”,”(())()”,”()(())”,”()()()”] 示例 2: 输入:n =…

LeetCode Logo
AlgorithmLeetCode
20. 有效的括号

https://leetcode.cn/problems/valid-parentheses/description 给定一个只包括 ‘(‘,’)’,'{‘,’}’,'[‘,’]’ 的字符串 s ,判断字符串是否有效。 有效字符串需满足: 左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭合。 每个右括号都有一个对应的相同类型的左括号。 示例 1: 输入:s = “()” 输出:true…

LeetCode Logo
AlgorithmLeetCode
21. 合并两个有序链表

https://leetcode.cn/problems/merge-two-sorted-lists 将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。  示例 1: 输入:l1 = [1,2,4], l2 = [1,3,4] 输出:[1,1,2,3,4,4] 示例…

LeetCode Logo
AlgorithmLeetCode
206. 反转链表

https://leetcode.cn/problems/reverse-linked-list/description 给你单链表的头节点 head ,请你反转链表,并返回反转后的链表。 示例 1: 输入:head = [1,2,3,4,5] 输出:[5,4,3,2,1] 示例 2: 输入:head =…

Must Read

Subscribe for New Articles!