xixi2


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 搜索

快速排序算法

发表于 2019-09-27 | 分类于 leetcode

对于快速排序过程中一个的问题:为什么在qsort中递归时,需要将递归范围改为[lo, pos-1]而不是[lo, pos]?

阅读全文 »

221.Maximal Square

发表于 2019-09-27 | 分类于 leetcode

Maximal Square

Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.

阅读全文 »

单调序列

发表于 2019-09-27 | 分类于 leetcode
  1. Monotonic Array

An array is monotonic if it is either monotone increasing or monotone decreasing.

An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array A is monotone decreasing if for all i <= j, A[i] >= A[j].

Return true if and only if the given array A is monotonic.

阅读全文 »

单调栈

发表于 2019-09-27 | 分类于 leetcode

什么是单调栈?

阅读全文 »

从数组中找重复数字系列

发表于 2019-09-27 | 分类于 leetcode

287. Find the Duplicate Number

  • 方法一:排序,将整个数组进行排序.排序的时间复杂度和空间复杂度取决于使用的排序算法.
    这里要求额外空间排序度为O(1),那么只能用堆排序.
  • 方法二:使用set
  • 方法三
    • 前面方法一都会修改数组,不满足要求.方法二的额外空间复杂度是O(n),同样不满足要求.
    • https://leetcode.com/problems/find-the-duplicate-number/

k sum 系列

发表于 2019-09-27 | 分类于 leetcode

two sum
Two Sum II - Input array is sorted
3Sum
4Sum
4Sum II
k sum

冒泡排序的优化和鸡尾酒排序

发表于 2019-09-27 | 分类于 leetcode

冒泡排序的优化有设置哨兵来表示当前整个数组已经有序,以及设置有序区间,下一次只对有序区间进行排序(尚未完全理解).

阅读全文 »

旋转数组

发表于 2019-09-27 | 分类于 leetcode
  1. Rotate Array
    旋转数组

Given an array, rotate the array to the right by k steps, where k is non-negative.

阅读全文 »

404. Sum of Left Leaves

发表于 2019-09-27 | 分类于 leetcode

题目链接

Find the sum of all left leaves in a given binary tree.

阅读全文 »

142. Linked List Cycle II

发表于 2019-09-27 | 分类于 leetcode , 剑指offer

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.

To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list.

Note: Do not modify the linked list.

阅读全文 »
1…131415…18
xixi2

xixi2

一去不复返的远方还有无法抵达的过去

175 日志
21 分类
107 标签
© 2019 xixi2
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.4
访问人数 总访问量 次