Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ...
分类:
其他好文 时间:
2017-06-25 11:57:45
阅读次数:
228
从今天开始我的LintCode之旅,由于C/C++好久没有使用了,语法生疏不说,低级错误频繁出现,因此在做题之后,还会有部分时间复习语法项目。 单例模式: 单例 是最为最常见的设计模式之一。对于任何时刻,某个类只存在且最多存在一个具体的实例。 C++实现单例模式的思路是:类成员包含一个类对象的指针, ...
分类:
其他好文 时间:
2017-06-24 19:39:00
阅读次数:
109
给定两个字符串,请设计一个方法来判定其中一个字符串是否为另一个字符串的置换。 置换的意思是,通过改变顺序可以使得两个字符串相等。 ...
分类:
其他好文 时间:
2017-06-24 17:15:03
阅读次数:
205
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. Given a string containing just ...
分类:
其他好文 时间:
2017-06-24 10:07:06
阅读次数:
171
Given an integer, convert it to a roman numeral. The number is guaranteed to be within the range from 1 to 3999. Given an integer, convert it to a rom ...
分类:
其他好文 时间:
2017-06-23 10:30:51
阅读次数:
109
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Given a string, find the first non ...
分类:
其他好文 时间:
2017-06-23 10:17:03
阅读次数:
132
Given a roman numeral, convert it to an integer. The answer is guaranteed to be within the range from 1 to 3999. Given a roman numeral, convert it to ...
分类:
其他好文 时间:
2017-06-23 10:13:54
阅读次数:
122
题目: Given n x m non-negative integers representing an elevation map 2d where the area of each cell is 1 x 1, compute how much water it is able to trap ...
分类:
移动开发 时间:
2017-06-22 21:47:12
阅读次数:
276
1.两个数的交换 利用异或运算可以实习一种简单的不使用第三个数的交换方式, 代码如下所示: 原因是:异或运算是它本身的逆运算,故对于两个数或是布尔变量有如下性质: 给出2*n + 1 个的数字,除其中一个数字之外其他每个数字均出现两次,找到这个数字。 样例 给出 [1,2,2,1,3,4,3],返回 ...
分类:
其他好文 时间:
2017-06-21 00:54:50
阅读次数:
391
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Given a m x n matrix, if an element is 0, set its entire ...
分类:
其他好文 时间:
2017-06-21 00:54:32
阅读次数:
203