1 2 3 4 5 ··· 16 下一页
摘要: 改进版快排,pivot 不再是左边第一个元素,而是正中间元素(或者随机)。 有一个比较坑的地方就是,在每一趟双指针完成所有交换后,需要判断 pivot 需不需要被交换。 比如 test case 1 2 4 3,第一趟开始时 pivot 是 2, 先动右边的指针 j, 找到第一个比 2 小的数也就是 阅读全文
posted @ 2022-08-03 00:06 bw98 阅读(31) 评论(0) 推荐(0) 编辑
摘要: Description Given an array A of integers, return the number of (contiguous, non empty) subarrays that have a sum divisible by K. Example 1: Note: 1 思路 阅读全文
posted @ 2020-05-22 12:09 bw98 阅读(216) 评论(0) 推荐(0) 编辑
摘要: Description Given an array of integers and an integer k, you need to find the number of unique k diff pairs in the array. Here a k diff pair is define 阅读全文
posted @ 2020-05-17 01:07 bw98 阅读(236) 评论(0) 推荐(0) 编辑
摘要: Description Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: Follow up: Could you do it in O(n) time and O(1) space? 阅读全文
posted @ 2020-05-10 13:18 bw98 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Description Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies 阅读全文
posted @ 2020-04-23 17:49 bw98 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Description Given an array of non negative integers, you are initially positioned at the first index of the array. Each element in the array represent 阅读全文
posted @ 2020-04-22 16:15 bw98 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Description Given an array of non negative integers, you are initially positioned at the first index of the array. Each element in the array represent 阅读全文
posted @ 2020-04-21 21:20 bw98 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Description Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between 阅读全文
posted @ 2020-04-20 19:04 bw98 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Description Given an array of citations sorted in ascending order (each citation is a non-negative integer) of a researcher, write a function to compu 阅读全文
posted @ 2020-04-18 19:49 bw98 阅读(191) 评论(0) 推荐(0) 编辑
摘要: Description Given an array of citations (each citation is a non negative integer) of a researcher, write a function to compute the researcher's h inde 阅读全文
posted @ 2020-04-17 14:45 bw98 阅读(290) 评论(0) 推荐(0) 编辑
1 2 3 4 5 ··· 16 下一页