![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
排序
文章平均质量分 85
memcpy0
希望探索文理结合的自由之路。
展开
-
LeetCode 3132. 找出与数组相加的整数 II【排序,同向双指针;技巧】中等【Py3,Java,C++,C,GO,JS,Rust】
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2024-08-10 01:55:04 · 554 阅读 · 0 评论 -
LeetCode 1686. 石子游戏 VI【排序,贪心】【Py3,Go】2000
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2024-02-03 01:25:56 · 732 阅读 · 0 评论 -
LeetCode 1465. 切割后面积最大的蛋糕【贪心,数组,排序】1444
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-10-28 13:27:32 · 173 阅读 · 0 评论 -
LeetCode 1402. 做菜顺序【排序,动态规划;贪心,前缀和,递推】1679
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-10-22 14:50:56 · 184 阅读 · 0 评论 -
LeetCode 2895. 最小处理时间【贪心,排序】1351
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-10-18 14:26:46 · 175 阅读 · 0 评论 -
LeetCode 462. 最小操作次数使数组元素相等 II【贪心,排序或快速选择】中等
Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by 1.You may assume the array’s length is at most 10,000.原创 2023-10-16 00:03:39 · 501 阅读 · 1 评论 -
LeetCode 2731. 移动机器人【脑筋急转弯,排序,前缀和】1922
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-10-11 00:39:18 · 109 阅读 · 0 评论 -
LeetCode 2578. 最小和分割【贪心,排序+奇偶分组】1350
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-10-10 10:28:17 · 91 阅读 · 0 评论 -
LeetCode 1647. Minimum Deletions to Make Character Frequencies Unique【贪心,排序】1509
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。为了方便在PC上运行调试、分享代码文件,我还建立了相关的。原创 2023-09-13 08:52:01 · 57 阅读 · 0 评论 -
LeetCode 2681. Power of Heroes【排序,数学,贡献法】2060
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-08-20 20:24:15 · 344 阅读 · 0 评论 -
LeetCode 436. Find Right Interval【排序,二分;双指针,莫队】中等
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-07-29 13:31:43 · 252 阅读 · 0 评论 -
LeetCode 2500. Delete Greatest Value in Each Row【数组,排序】简单
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-07-27 13:46:20 · 174 阅读 · 0 评论 -
LeetCode 2679. Sum in a Matrix【数组,排序】中等
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-07-04 22:16:28 · 271 阅读 · 0 评论 -
LeetCode 1552. Magnetic Force Between Two Balls【二分,排序,贪心】中等
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-06-01 23:44:08 · 837 阅读 · 0 评论 -
LeetCode 1552. Magnetic Force Between Two Balls【二分,排序,贪心】中等
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-06-01 23:41:37 · 369 阅读 · 0 评论 -
LeetCode 1626. Best Team With No Conflicts【排序,动态规划,数组】中等
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。。原创 2023-03-23 13:30:37 · 221 阅读 · 0 评论 -
LeetCode 2363. Merge Similar Items【哈希表,有序映射,排序】
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。为了方便在PC上运行调试、分享代码文件,我还建立了相关的。原创 2023-03-01 04:09:26 · 75 阅读 · 0 评论 -
LeetCode 1610. Maximum Number of Visible Points【计算几何/排序/滑动窗口/数学】困难
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。为了方便在PC上运行调试、分享代码文件,我还建立了相关的仓库。在这一仓库中,你不仅可以看到LeetCode原题链接、题解代码、题解文章链接、同类.原创 2021-12-18 18:37:53 · 156 阅读 · 0 评论 -
LeetCode 1005. Maximize Sum Of Array After K Negations【数组/排序/贪心】简单
本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章中,我不仅会讲解多种解题思路及其优化,还会用多种编程语言实现题解,涉及到通用解法时更将归纳总结出相应的算法模板。为了方便在PC上运行调试、分享代码文件,我还建立了相关的仓库。在这一仓库中,你不仅可以看到LeetCode原题链接、题解代码、题解文章链接、同类.原创 2021-12-14 23:12:12 · 122 阅读 · 0 评论 -
LeetCode 969. Pancake Sorting【排序/数组】中等
Given an array of integers arr, sort the array by performing a series of pancake flips.In one pancake flip we do the following steps: Choose an integer k where 1 <= k <= arr.length. Reverse the sub-array arr[0...k-1] (0-indexed).For example, if原创 2021-06-07 01:01:17 · 165 阅读 · 0 评论 -
1877. Minimize Maximum Pair Sum in Array【贪心/排序】
The pair sum of a pair (a,b) is equal to a + b. The maximum pair sum is the largest pair sum in a list of pairs. For example, if we have pairs (1,5), (2,3), and (4,4), the maximum pair sum would be max(1+5, 2+3, 4+4) = max(6, 5, 8) = 8.Given an array n原创 2021-06-01 07:09:38 · 459 阅读 · 0 评论 -
LeetCode C++ 791. Custom Sort String【String/Sort】中等
S and T are strings composed of lowercase letters. In S, no letter occurs more than once.S was sorted in some custom order previously. We want to permute the characters of T so that they match the order that S was sorted. More specifically, if x occurs be原创 2021-05-05 21:01:54 · 144 阅读 · 0 评论 -
LeetCode C++ 面试题 16.16. Sub Sort LCCI【Sort】中等
Given an array of integers, write a method to find indices m and n such that if you sorted elements m through n, the entire array would be sorted. Minimize n - m (that is, find the smallest such sequence).Return [m,n]. If there are no such m and n (e.g. t原创 2021-04-21 22:36:21 · 239 阅读 · 0 评论 -
LeetCode C++ 面试题 16.21. Sum Swap LCCI【Hash Table/Sort】中等
Given two arrays of integers, find a pair of values (one value from each array) that you can swap to give the two arrays the same sum.Return an array, where the first element is the element in the first array that will be swapped, and the second element i原创 2021-04-21 22:31:00 · 144 阅读 · 0 评论 -
LeetCode C++ 435. Non-overlapping Intervals【贪心/排序/动态规划】中等
Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Example 1:Input: [[1,2],[2,3],[3,4],[1,3]]Output: 1Explanation: [1,3] can be removed and the rest of intervals ar原创 2020-12-31 15:49:48 · 234 阅读 · 0 评论 -
基础编程题目集 函数题部分
文章目录6-1 简单输出整数 (10分)6-2 多项式求值 (15分)6-3 简单求和 (10分)6-4 求自定类型元素的平均 (10分)6-5 求自定类型元素的最大值 (10分)6-6 求单链表结点的阶乘和 (15分)6-7 统计某类完全平方数 (20分)6-8 简单阶乘计算 (10分)6-9 统计个位数字 (15分)6-12 判断奇偶性 (10分)6-13 折半查找 (15分)做这些简单的题...原创 2020-01-22 21:24:16 · 2557 阅读 · 0 评论 -
LeetCode C++ 976. Largest Perimeter Triangle【Greedy/Sort】简单
Given an array A of positive lengths, return the largest perimeter of a triangle with non-zero area, formed from 3 of these lengths.If it is impossible to form any triangle of non-zero area, return 0.Example 1:Input: [2,1,2]Output: 5Example 2:Input:原创 2020-11-30 12:44:30 · 261 阅读 · 0 评论 -
LeetCode C++ 454. 4Sum II【Hash Table/Sort/Two Pointers/Binary Search】中等
Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same length of N where 0 ≤ N ≤ 500. All integers are in the range o原创 2020-11-28 14:27:10 · 299 阅读 · 0 评论 -
LeetCode 242. 有效的字母异位词【哈希表】简单
Given two strings s and t , write a function to determine if t is an anagram of s .Example 1:Input: s = "anagram", t = "nagaram"Output: trueExample 2:Input: s = "rat", t = "car"Output: falseNote:You may assume the string contains only lowercase a原创 2020-09-16 22:20:48 · 346 阅读 · 1 评论 -
LeetCode C++ 1030. Matrix Cells in Distance Order【Sort/BFS】简单
We are given a matrix with R rows and C columns has cells with integer coordinates (r, c), where 0 <= r < R and 0 <= c < C.Additionally, we are given a cell in that matrix with coordinates (r0, c0).Return the coordinates of all cells in the m原创 2020-11-17 10:30:41 · 193 阅读 · 0 评论 -
LeetCode C++ 1122. Relative Sort Array【Hash Table/Sort】简单
文章目录EASY级别EASY级别原创 2019-11-18 19:05:03 · 245 阅读 · 0 评论 -
LeetCode C++ 1464. Maximum Product of Two Elements in an Array【Array/Sort】简单
Given the array of integers nums, you will choose two different indices i and j of that array. Return the maximum value of (nums[i] - 1) * (nums[j] - 1) .Example 1:Input: nums = [3,4,5,2]Output: 12 Explanation: If you choose the indices i=1 and j=2 (in原创 2020-11-13 00:46:49 · 172 阅读 · 0 评论 -
LeetCode C++ 953. Verifying an Alien Dictionary【String/Sort】简单
In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.Given a sequence of words written in the alien language, and the order of the原创 2020-11-09 21:17:11 · 168 阅读 · 0 评论 -
LeetCode C++ 剑指 Offer 40. 最小的k个数【Sort/Heap/分治】简单
输入整数数组 arr ,找出其中最小的 k 个数。例如,输入4、5、1、6、2、7、3、8这8个数字,则最小的4个数字是1、2、3、4。示例 1:输入:arr = [3,2,1], k = 2输出:[1,2] 或者 [2,1]示例 2:输入:arr = [0,1,2,1], k = 1输出:[0]限制:0 <= k <= arr.length <= 100000 <= arr[i] <= 10000题意:不用说明。解法1 sort 排序clas原创 2020-11-06 21:06:52 · 181 阅读 · 0 评论 -
LeetCode 1356. 根据数字二进制下 1 的数目排序【递推预处理或查表计算,位运算,排序】简单
Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1’s in their binary representation and in case of two or more integers have the same number of 1’s you have to sort them in ascending order.Return t原创 2020-11-06 17:45:19 · 294 阅读 · 0 评论 -
LeetCode C++ 57. Insert Interval【Sort/Array】困难
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Input: intervals = [[1,3],[6,9]], newInterval = [2,5原创 2020-11-04 18:24:25 · 210 阅读 · 0 评论 -
LeetCode C++ 128. Longest Consecutive Sequence【Sort/Hash Table】困难
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Example:Input: [100, 4, 200, 1, 3, 2]Output: 4Explanation: The longest consecutive elements sequence is [1,原创 2020-06-06 13:42:45 · 205 阅读 · 0 评论 -
LeetCode C++ 1502. Can Make Arithmetic Progression From Sequence【Sort/Array】简单
Given an array of numbers arr. A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same.Return true if the array can be rearranged to form an arithmetic progression, otherwise, return fal原创 2020-11-03 00:09:23 · 152 阅读 · 0 评论 -
LeetCode 56. Merge Intervals【排序/数组】中等
Given a collection of intervals, merge all overlapping intervals.Example 1:Input: intervals = [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].Example 2:Input: int原创 2020-10-18 09:11:52 · 156 阅读 · 1 评论 -
LeetCode C++ 23. Merge k Sorted Lists【排序/堆/分治/链表】困难
You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it.Example 1:Input: lists = [[1,4,5],[1,3,4],[2,6]]Output: [1,1,2,3,4,4,5,6]Explanation: Th原创 2020-10-08 20:01:08 · 221 阅读 · 0 评论