BlooooooG


  • Home

  • Categories

  • Archives

  • Tags

  • Search

LeetCode Problem 88-Merge Sorted Array

Posted on 2019-04-10 | In LeetCode | Visitors

合并两个有序数组。给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1 中,使得 num1 成为一个有序数组。

说明:

  • 初始化 nums1 和 nums2 的元素数量分别为 m 和 n。
  • 你可以假设 nums1 有足够的空间(空间大小大于或等于 m + n)来保存 nums2 中的元素。
Read more »

LeetCode Problem 87-Scramble String

Posted on 2019-04-10 | In LeetCode | Visitors

扰乱字符串。给定一个字符串 s1,我们可以把它递归地分割成两个非空子字符串,从而将其表示为二叉树。

下图是字符串 s1 = "great" 的一种可能的表示形式。

1
2
3
4
5
6
7
    great
   /    \
  gr    eat
 / \    /  \
g   r  e   at
           / \
          a   t
Read more »

LeetCode Problem 86-Partition List

Posted on 2019-04-09 | In LeetCode | Visitors

分隔链表。给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前。

你应当保留两个分区中每个节点的初始相对位置。

示例:

1
2
输入: head = 1->4->3->2->5->2, x = 3
输出: 1->2->2->4->3->5
Read more »

LeetCode Problem 85-Maximal Rectangle

Posted on 2019-04-09 | In LeetCode | Visitors

最大矩形。给定一个仅包含 0 和 1 的二维二进制矩阵,找出只包含 1 的最大矩形,并返回其面积。

示例:

1
2
3
4
5
6
7
8
输入:
[
  ["1","0","1","0","0"],
  ["1","0","1","1","1"],
  ["1","1","1","1","1"],
  ["1","0","0","1","0"]
]
输出: 6
Read more »

LeetCode Problem 84-Largest Rectangle in Histogram

Posted on 2019-04-07 | In LeetCode | Visitors

柱状图中最大的矩形。给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。

求在该柱状图中,能够勾勒出来的矩形的最大面积。

Read more »

LeetCode Problem 83-Remove Duplicates from Sorted List

Posted on 2019-03-29 | In LeetCode | Visitors

删除排序链表中的重复元素。给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。

Read more »

LeetCode Problem 82-Remove Duplicates from Sorted List II

Posted on 2019-03-29 | In LeetCode | Visitors

删除排序链表中的重复元素 II。给定一个排序链表,删除所有含有重复数字的节点,只保留原始链表中 没有重复出现 的数字。

Read more »

LeetCode Problem 81-Search in Rotated Sorted Array II

Posted on 2019-03-29 | In LeetCode | Visitors

搜索旋转排序数组 II。假设按照升序排序的数组在预先未知的某个点上进行了旋转。

( 例如,数组 [0,0,1,2,2,5,6] 可能变为 [2,5,6,0,0,1,2] )。

编写一个函数来判断给定的目标值是否存在于数组中。若存在返回 true,否则返回 false。

Read more »

LeetCode Problem 80-Remove Duplicates from Sorted Array II

Posted on 2019-03-28 | In LeetCode | Visitors

删除排序数组中的重复项 II。给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素最多出现两次,返回移除后数组的新长度。

不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。

Read more »

LeetCode Problem 79-Word Search

Posted on 2019-03-28 | In LeetCode | Visitors

单词搜索。给定一个二维网格和一个单词,找出该单词是否存在于网格中。

单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。

Read more »
1 … 3 4 5 … 14
Wendell Gu

Wendell Gu

138 posts
4 categories
68 tags
GitHub
© 2021 Wendell Gu
Powered by Jekyll
Theme - NexT.Mist
Storage Service - UPYUN