ZMR小站

很高兴遇见你~


  • 首页

  • 标签

  • 分类

  • 归档

newBlog

发表于 2019-09-13

重启BLOG

这么久经历了,太多的起伏和变动 不想丢了自己的初心

阅读全文 »

p4

发表于 2017-06-06 | 分类于 blog

LeetCode p4 Median of Two Sorted Arrays 题解

1.题目:

There are two sorted arrays nums1 and nums2 of size m and n respectively.

Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

Example 1:
nums1 = [1, 3]
nums2 = [2]

The median is 2.0
Example 2:
nums1 = [1, 2]
nums2 = [3, 4]

The median is (2 + 3)/2 = 2.5

阅读全文 »

p402

发表于 2017-03-27 | 分类于 blog

LeetCode p402 Remove K Digits 题解

1.题目:

Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.

Note:
The length of num is less than 10002 and will be ≥ k.
The given num does not contain any leading zero.
Example 1:

Input: num = “1432219”, k = 3
Output: “1219”
Explanation: Remove the three digits 4, 3, and 2 to form the new number 1219 which is the smallest.
Example 2:

Input: num = “10200”, k = 1
Output: “200”
Explanation: Remove the leading 1 and the number is 200. Note that the output must not contain leading zeroes.
Example 3:

Input: num = “10”, k = 2
Output: “0”
Explanation: Remove all the digits from the number and it is left with nothing which is 0.

阅读全文 »

p19

发表于 2017-03-26 | 分类于 blog

LeetCode p19 Remove Nth Node From End of List 题解

1.题目:

Given a linked list, remove the nth node from the end of list and return its head.

For example,

Given linked list: 1->2->3->4->5, and n = 2.

After removing the second node from the end, the linked list becomes 1->2->3->5.

Note:
Given n will always be valid.
Try to do this in one pass.

阅读全文 »

p50

发表于 2017-03-26 | 分类于 blog

LeetCode p50 Pow(x, n) 题解

1.题目:

Implement pow(x, n).

阅读全文 »

p120

发表于 2017-03-20 | 分类于 blog

LeetCode p120 Triangle 题解

1.题目:

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.

For example, given the following triangle
[
[2],
[3,4],
[6,5,7],
[4,1,8,3]
]
The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11).

阅读全文 »

p56

发表于 2017-03-18 | 分类于 blog

LeetCode p56 Merge Intervals 题解

1.题目:

Given a collection of intervals, merge all overlapping intervals.

For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].

阅读全文 »

12…33
ZhangMengRou

ZhangMengRou

ZMR小站

230 日志
4 分类
14 标签
© 2019 ZhangMengRou
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.4