闪烁之狐
|
每日温度-739 每日温度-739
力扣(LeetCode) 链接:https://leetcode.cn/problems/daily-temperatures/ 思路通常是一维数组,要寻找任一个元素的右边或者左边第一个比自己大或者小的元素的位置,此时我们就要想到可以用单调
2023-05-30
ES2023,学习走起 ES2023,学习走起
ES6 是 2015 年提出的,按照这个逻辑 ES2023 应该叫做 ES14,为了避免混淆,我们就用年份来命名。为了赶上 ES 标准迭代的步伐,我们一起来看看 2023 年又加入了哪些新特性。 一、从尾部查找 涉及到两个函数 find
2023-05-29
yaml的使用 yaml的使用
1.YAML YAML 是专门用来写配置文件的语言,非常简洁和强大,远比 JSON 格式方便 JS 在线验证器 2.基本规则 大小写敏感 使用缩进表示层级关系 缩进时不允许使用 Tab 键,只允许使用空格。 缩进的空格数目不重要,只要相同
2023-05-26
快排 快排
方法一const arr = [5, 3, 1, 2, 8, 0, 4] function fn(arr, left = 0, right = arr.length - 1) { if (left >= right) ret
2023-05-25
归并排序 归并排序
解析 分解子问题:将需要被排序的数组从中间分割为两半,然后再将分割出来的每个子数组各分割为两半,重复以上操作,直到单个子数组只有一个元素为止。 求解每个子问题:从粒度最小的子数组开始,两两合并、确保每次合并出来的数 答案function
2023-05-25
合并两个有序数组-88 合并两个有序数组-88
力扣(LeetCode) 链接:https://leetcode.cn/problems/merge-sorted-array/description/ 空间复杂度 O(1)var merge = function (nums1, m, n
2023-05-25
和为s的两个数字 和为s的两个数字
描述输入一个递增排序的数组和一个数字 s,在数组中查找两个数,使得它们的和正好是 s。如果有多对数字的和等于 s,则输出任意一对即可。 解题// 通过双指针解决 function twoSum(nums, target) {
2023-05-24
删除链表的倒数第N个节点-19 删除链表的倒数第N个节点-19
力扣(LeetCode) 链接:https://leetcode.cn/problems/remove-nth-node-from-end-of-list/discussion/ var removeNthFromEnd = functio
2023-05-24 高红翔
链表的中间结点-876 链表的中间结点-876
力扣(LeetCode) 链接:https://leetcode.cn/problems/middle-of-the-linked-list/discussion/ var middleNode = function (head)
2023-05-24
删除数组中的重复项-26 删除数组中的重复项-26
力扣(LeetCode) 链接:https://leetcode.cn/problems/remove-duplicates-from-sorted-array/discussion/ var removeDuplicates = func
2023-05-24
移动零 移动零
力扣(LeetCode) 链接:https://leetcode.cn/problems/move-zeroes/ var moveZeroes = function (nums) { let slow = 0 let f
2023-05-24
移动元素-283 移动元素-283
力扣(LeetCode) 链接:https://leetcode.cn/problems/remove-element/ function removeElement(nums, val) { let slow = 0 l
2023-05-24
6 / 10