Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
其他好文 时间:
2014-06-18 13:29:31
阅读次数:
214
原题如下,意思就是说无序数组(由0,1,2组成),一遍扫描,把数组整理成0,1,2这样的序列。
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red,...
分类:
其他好文 时间:
2014-06-18 07:12:43
阅读次数:
174
1、
??
Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m =
2 and n = 4,
return 1->4->3->2->5->NULL....
分类:
其他好文 时间:
2014-06-17 23:03:12
阅读次数:
257
/*声明一个类模板,利用它分别实现两个整数.
浮点数和字符的比较,求出大数和小数。
说明:在类模板外定义各成员函数。
输入两个整数、两个浮点数和两个字符
从大到小输出两个整数、两个浮点数和两个字符
*/
#include
#include
using namespace std;
template
class Compare
{
public:
Compare...
分类:
其他好文 时间:
2014-06-17 19:08:27
阅读次数:
266
原题地址:https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/题意:Given a string, find the length of the longest substring witho...
分类:
编程语言 时间:
2014-06-15 19:51:00
阅读次数:
254
求第k个排列。刚开始按照一个排列一个排列的求,超时。于是演算了一下,发下有数学规律,其实就是康托解码。康托展开:全排列到一个自然数的双射X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0!ai为整数,并且0 fractial; fr...
分类:
其他好文 时间:
2014-06-15 07:13:59
阅读次数:
192
原题地址:https://oj.leetcode.com/problems/add-two-numbers/题意:You are given two linked lists representing two non-negative numbers. The digits are stored i...
分类:
编程语言 时间:
2014-06-15 00:40:44
阅读次数:
328
刚刚A了那题之后 想到以前自己的OJ那边有个整数划分...同时 tz 那边也有个很相似的 我是做了TZ的再做了自己OJ的 一起 放上链接 touch me touch me其实 我们解决的问题 应该主要是 字典序的输出和不能重复的输出就是说 1+1+2出现了 那么1+2+1就不应该出现 -- ...
分类:
其他好文 时间:
2014-06-14 22:49:58
阅读次数:
273
原始题目如下,意为寻找数组和最大的子串,返回这个最大和即可。
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the...
分类:
其他好文 时间:
2014-06-14 15:08:00
阅读次数:
224
1、
??
Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return ...
分类:
其他好文 时间:
2014-06-14 14:11:27
阅读次数:
315