ZMR小站

很高兴遇见你~


  • 首页

  • 标签

  • 分类

  • 归档

p260

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

LeetCode 260 Single Number III 题解

1.题目:

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.

For example:

Given nums = [1, 2, 1, 3, 2, 5], return [3, 5].

阅读全文 »

p283

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

LeetCode P283 Move Zeroes 题解

1.题目:

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.

For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0].

Note:

You must do this in-place without making a copy of the array.
Minimize the total number of operations.

阅读全文 »

Set接口

发表于 2016-05-24 | 分类于 blog

Set

Set是一个接口继承自Collection(集合)

Set是一种不包含重复的元素的无序Collection。
Set是接口,自身没有具体实现。

阅读全文 »

p349

发表于 2016-05-24 | 分类于 blog

LeetCode P349 Intersection of Two Arrays 题解

1.题目:

Given two arrays, write a function to compute their intersection.

Example:
Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].

Note:

Each element in the result must be unique.
The result can be in any order.

题意:

输入两个int类型的数组,返回一个数组内容是它们的公共部分,不允许有重复,顺序随意

阅读全文 »

p226

发表于 2016-05-13 | 分类于 blog

LeetCode P226 Invert Binary Tree 题解

1.题目:

Invert a binary tree.

题意:

将一个二叉树反转

阅读全文 »

P104

发表于 2016-05-13 | 分类于 blog

LeetCode P104 Maximum Depth of Binary Tree 题解

1.题目:

Given a binary tree, find its maximum depth.

The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

Subscribe to see which companies asked this question

题意:

找出一个二叉树最长一个分支上面节点的个数

阅读全文 »

二叉树(BinaryTree)

发表于 2016-05-11 | 分类于 blog

二叉树

1…30313233
ZhangMengRou

ZhangMengRou

ZMR小站

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