上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页
摘要: LeetCode 560. Subarray Sum Equals K 题目描述 Given an array of integers nums and an integer k, return the total number of continuous subarrays whose sum e 阅读全文
posted @ 2021-04-09 14:47 与MPI做斗争 阅读(47) 评论(0) 推荐(0) 编辑
摘要: LeetCode 973. K Closest Points to Origin 题目描述 Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k 阅读全文
posted @ 2021-04-09 13:36 与MPI做斗争 阅读(51) 评论(0) 推荐(0) 编辑
摘要: LeetCode 786. K-th Smallest Prime Fraction 一道经典题,给出两种经典解法。 题目描述 You are given a sorted integer array arr containing 1 and prime numbers, where all the 阅读全文
posted @ 2021-04-03 17:36 与MPI做斗争 阅读(43) 评论(0) 推荐(0) 编辑
摘要: LeetCode 378. Kth Smallest Element in a Sorted Matrix 一道经典的二分查找的题目,特点在于查找对象从一位有序数组变成了二位行列有序数组。 题目描述 Given an n x n matrix where each of the rows and c 阅读全文
posted @ 2021-04-03 15:51 与MPI做斗争 阅读(51) 评论(0) 推荐(0) 编辑
摘要: priority_queue 自定义 comparator LeetCode 373. Find K Pairs with Smallest Sums 本文重点记录需要自定义 comparator 时的priority_queue 的写法。 题目描述 You are given two intege 阅读全文
posted @ 2021-03-28 21:03 与MPI做斗争 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 原地调整法查找数组元素 题目描述 这一类题目一般是给出一个数组,数组元素的取值范围在 1~n 之间,其中 n 是数组元素个数,然后要求找出缺失元素或者重复元素,缺失或重复的元素可以是一个或多个。例如: LeetCode 448. Find All Numbers Disappeared in an 阅读全文
posted @ 2021-03-28 14:16 与MPI做斗争 阅读(66) 评论(0) 推荐(0) 编辑
摘要: LeetCode 436. Find Right Interval 一道需要自定义比较函数的二分查找题。 这里重点展示自定义比较,给出比较函数、比较器、lambda三种写法。 题目描述 You are given an array of intervals, where intervals[i] = 阅读全文
posted @ 2021-03-28 13:02 与MPI做斗争 阅读(47) 评论(0) 推荐(0) 编辑
摘要: LeetCode 611. Valid Triangle Number 题目描述 Given an array consists of non-negative integers, your task is to count the number of triplets chosen from th 阅读全文
posted @ 2021-03-27 19:18 与MPI做斗争 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 二叉树遍历可以使用递归/非递归的方式完成,对于递归,最简洁的思路是模拟栈的工作,使用一个辅助栈来完成,从而时间复杂度O(N)空间复杂度也是O(N)。 那么有没有一种时间复杂度O(N)但是空间复杂度O(1)的方法呢? Morris Traversal 可以做到这两点,它使用叶结点的子结点为空这一特性来 阅读全文
posted @ 2021-03-26 16:25 与MPI做斗争 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 用户态IO:DPDK 在讲多路复用的时候,我们提到:多路复用本身仍然是同步I/O,数据从内核空间到用户空间仍然存在一次拷贝,影响效率。其实对于大容量网络通信(如交换机)而言,不仅数据拷贝的开销不可接受,系统调用频繁的上下文切换也是难以忽视的开销。 Intel DPDK(Data Plane Deve 阅读全文
posted @ 2021-03-26 10:56 与MPI做斗争 阅读(391) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页