ZMR小站

很高兴遇见你~


  • 首页

  • 标签

  • 分类

  • 归档

p328

发表于 2016-07-29 | 分类于 blog

LeetCode 328 Odd Even Linked List 题解

1.题目:

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.
Example:
Given 1->2->3->4->5->NULL,
return 1->3->5->2->4->NULL.

阅读全文 »

p287

发表于 2016-07-28 | 分类于 blog

LeetCode 287 Find the Duplicate Number 题解

1.题目:

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.

阅读全文 »

p12

发表于 2016-07-28 | 分类于 blog

LeetCode 12 Integer to Roman 题解

1.题目:

Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.

阅读全文 »

p206

发表于 2016-07-27 | 分类于 blog

LeetCode 206 Reverse Linked List 题解

1.题目:

Reverse a singly linked list.

阅读全文 »

p13

发表于 2016-07-27 | 分类于 blog

LeetCode 13 Roman to Integer 题解

1.题目:

Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.

阅读全文 »

p371

发表于 2016-07-26 | 分类于 blog

LeetCode 371 Sum of Two Integers 题解

1.题目:

Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
Example:
Given a = 1 and b = 2, return 3.

阅读全文 »

p357

发表于 2016-07-26 | 分类于 blog

LeetCode 357 Count Numbers with Unique Digits 题解

1.题目:

Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.
Example:
Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excluding [11,22,33,44,55,66,77,88,99])

阅读全文 »
1…272829…33
ZhangMengRou

ZhangMengRou

ZMR小站

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