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.Fo...
分类:
其他好文 时间:
2014-09-09 15:11:38
阅读次数:
140
题目原文:
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of conv...
分类:
其他好文 时间:
2014-09-09 13:04:18
阅读次数:
156
Valid Parentheses
Total Accepted: 17916 Total
Submissions: 63131My Submissions
Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
determine if the input stri...
分类:
其他好文 时间:
2014-09-07 16:03:05
阅读次数:
168
Valid Sudoku
Total Accepted: 13142 Total
Submissions: 47070My Submissions
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially fi...
分类:
其他好文 时间:
2014-09-07 13:33:35
阅读次数:
182
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana...
分类:
其他好文 时间:
2014-09-07 12:15:55
阅读次数:
292
整合两道差不多的题目放上来,其中第一题是第二题的基础。
1.
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two...
分类:
其他好文 时间:
2014-09-06 21:21:03
阅读次数:
279
Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
For example, given
s = "leetcode",...
分类:
其他好文 时间:
2014-09-06 18:46:33
阅读次数:
206
Description
Problem B
Cubes
You are given 12 rods of equal length. Each of them is colored in certain color. Your task is to determine in how many different ways one can construct a cube...
分类:
其他好文 时间:
2014-09-06 17:27:53
阅读次数:
253
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the c...
分类:
其他好文 时间:
2014-09-06 16:04:13
阅读次数:
191
每次给4个点坐标,确保没有三点共线,判断构成的是个什么四边形就行了,并输出类型。
我的做法:
用点积和叉积判断线与线的关系
我的代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
s...
分类:
其他好文 时间:
2014-09-06 14:54:13
阅读次数:
309