- 博客(14)
- 资源 (18)
- 收藏
- 关注
原创 Path Sum
Path Sum Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given th
2015-07-31 20:48:37 361
原创 Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.Th
2015-07-31 16:11:13 288
原创 Min Stack
Min Stack Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on
2015-07-30 22:33:28 318
原创 Symmetric Tree
Symmetric Tree 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 / \ 2 2 / \ / \
2015-07-30 21:35:44 361
原创 Climbing Stairs
Climbing Stairs You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
2015-07-29 22:00:36 299
原创 Factorial Trailing Zeroes
Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.思路:有多少个2与5相乘,就有多少个0,由于2远多于5,就是算有多
2015-07-27 19:28:00 275
原创 Container With Most Water
Container With Most Water Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints o
2015-07-27 17:05:27 308
原创 一周知识点总结20150726
2015-7-221.printf 内部的表达式从右开始向左计算;2.左移,右移运算符的优先级低于+ ,-。3.判断X是不是2的N次方的最快的方法是就让X减1后与X本身做与运算。4.对a和b做与运算就相当于求 他两个公共部分的一半,做异或运算就相当于求不同部分的和。5.定义宏,要把整体,变量,表达式都用括号括起来。6.任何不修改数据成员的函数都应该声明为const函数
2015-07-26 16:37:32 377
原创 1-9这9个数字组成并且都只出现一次 ,第一位能被1整除,前两位能被2整除
1-9这9个数字组成并且都只出现一次,这个九位数的第一位能被1整除,前两位能被2整除,前三位能被3整除...前九位能被9整除.解题需要注意的地方:1.设置全局数组实现回溯;2.在每一次调用里再次for循环,实现对每个位置每个数字的枚举。#include#includeusing namespace std;bool used[10];vector v;void dfs(i
2015-07-25 20:24:40 5611
原创 Integer to Roman
Integer to Roman Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.备注:只要弄明白roman numeral, 这个题不算难,自己出现的主要问题是在命名方面,注意:尽量少使用无法定义
2015-07-25 14:42:29 286
原创 螺旋队列
21 22 ...20 7 8 9 1019 6 1 2 1118 5 4 3 1217 16 15 14 13 看清以上数字排列的规律,设 1 点的坐标是 (0,0),x 方向向右为正,y 方向向下为正。例如,7 的坐标为 (-1,-1),2的坐标为 (0,1),3 的坐标为 (1,1)。编程实现输入任意一点坐标 (x,y),输
2015-07-25 10:06:36 286
原创 Two Sum
Two Sum Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to
2015-07-24 20:35:18 266
原创 ZigZag Conversion
ZigZag Conversion 先写下感悟:1.编写此段程序的时候,for循环里忘记了对长度(k 2.用string编程比char数组实现来的简单。The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may
2015-07-24 16:48:59 411
原创 Linked List Cycle
Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?采用快慢指针实现,快指针总会赶上慢指针。
2015-07-22 23:25:40 279
eclipse properties editor 离线安装包
2018-01-17
SVN_book文档
2016-11-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人