![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetCode
不管,我要跨世纪
不管,我要跨世纪
展开
-
Leetcode:4. 寻找两个正序数组的中位数(JavaScript)
```js var findMedianSortedArrays = function(nums1, nums2) { let res = 0; let newArr = nums1.concat(nums2).sort((a,b)=>a-b) let len = newArr.length if(len%2){ //取数组中间一位 res = newArr[Math.floo...原创 2020-09-13 20:16:16 · 313 阅读 · 0 评论 -
LeetCode :1266. 访问所有点的最小时间(JavaScript)
访问所有点的最小时间/**@param {number[][]} points@return {number}*/var minTimeToVisitAllPoints = function(points) {let count = 0;for(let i = 1; i<points.length;i++){let a = points[i-1]let b = points[i]count+=Math.max(Math.abs(b[0]-a[0]),Math.abs(b[1]-a原创 2020-09-01 08:44:00 · 91 阅读 · 0 评论 -
LeetCode :1. 两数之和(JavaScript)
/* * @lc app=leetcode.cn id=1 lang=javascript * * [1] 两数之和 */// @lc code=start/** * @param {number[]} nums * @param {number} target * @return {number[]} */ //1.两数之和 var twoSum = function(nums, target) { let arr = nums原创 2020-09-13 20:39:23 · 101 阅读 · 0 评论