Reverse every K-element Sub-list (medium) 7. Pattern: Tree Breadth First Search,树上的BFS 这种模式基于宽搜(Breadth First Search (BFS)),适用于需要遍历一颗树。借助于队列数据结构,从而能保证树的节点按照他们的层数打印出来。打印完当前层所有元素,才能执行到下一层。所有这种需要遍历树且需要一层一层遍...
1,“先易后难”的顺序去分,但不是按LC的easy medium hard这种,是按每个题的关系,有很多题是用...
View Code 九章最优解:(1)从右往左找到第一个破坏升序(非严格)的元素num1,下标为i;(2)从右往左找到第一个大于num1的元素num2,交换num1和num2;(3)从i+1到最右端逆置。 九章代码: View Code 278、First Bad Version 题意:一组产品从某个之后全是坏的,找第一个坏的 我的思路:二分 我的代码: Vie...
Find First Palindromic String in the Array Add all completed solutions Dec 28, 2021 Find First and Last Position of Element in Sorted Array Add all completed solutions Dec 28, 2021 Find Followers Count 1729. Find Followers Count Feb 28, 2023 Find Greatest Common Divisor of Array 1979. Find ...
1838.Frequency-of-the-Most-Frequent-Element (H-) 395.Longest-Substring-with-At-Least-K-Repeating-Characters (H) 1763.Longest-Nice-Substring (H) 2009.Minimum-Number-of-Operations-to-Make-Array-Continuous (M+) 2024.Maximize-the-Confusion-of-an-Exam (M) 424.Longest-Repeating-Character-Replacemen...
Remove Element 1 4 array Two Pointers 28 Implement strStr() 4 5 string Two Pointers KMP rolling hash 29 Divide Two Integers 4 3 Binary Search Math 30 Substring with Concatenation of All Words 3 1 string Two Pointers 31 Next Permutation 5 2 array permutation 32 Longest Valid Parentheses 4 1...
3. Longest Substring Without Repeating Characters (medium) 最长的无重复的子字符串 problem View Code 5. Longest Palindromic Substring (medium) 最长的对称子字符串 problem View Code 6. ZigZag Conversion (medium) 以zigzag顺序重排字符串 problem
If no element exists, return an empty string "". Challenge: Perform all these in O(1) time complexity. 【解答】实现一个数据结构,加一、减一,获取最大值的 key 和最小值的 key,都是 O(1) 的时间复杂度。 这类题目可以说遇到多次了,有一些通用思路: 要O(1),根据 key 去取 value 的,无非...
leetcode最经典100题 以下是LeetCode的最经典的100题:1.两数之和(Two Sum)2.两数相加(Add Two Numbers)3.无重复字符的最长子串(Longest Substring Without Repeating Characters)4.寻找两个有序数组的中位数(Median of Two Sorted Arrays)5.最长回文子串(Longest Palindromic Substring)6. Z字形变换(ZigZag ...
以下是LeetCode上的热门100题:1. Two Sum 2. Add Two Numbers 3. Longest Substring Without Repeating Characters 4. Median of Two Sorted Arrays 5. Longest Palindromic Substring 6. ZigZag Conversion 7. Reverse Integer 8. String to Integer (atoi)9. Palindrome Number 10. Regular Expression Matching ...