Description:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any posi...
分类:
移动开发 时间:
2015-06-25 00:04:46
阅读次数:
114
1. Question判断一个树是否是平衡二叉树(每个节点的两个子树深度差不超过1)Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is d...
分类:
其他好文 时间:
2015-06-24 23:54:40
阅读次数:
124
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine the total number of ways to...
分类:
其他好文 时间:
2015-06-23 23:10:22
阅读次数:
196
1. Question确定一个数是否是回文数。要求不使用额外空间。Determine whether an integer is a palindrome. Do this without extra space.2. Solution如果是负数,就不是回文数。2.1 reverse integer...
分类:
其他好文 时间:
2015-06-23 23:04:49
阅读次数:
132
题目:判断一个数是不是回文数Determine whether an integer is a palindrome. Do this without extra space.思路:借助上一道求整数逆序的思路,判断逆序后的数和原数是否相等就行。要注意,负数都不是回文数11506 / 11506 te...
分类:
其他好文 时间:
2015-06-23 19:48:42
阅读次数:
111
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Hide TagsLinked ListTwo Pointers分析:经典的快慢指针...
分类:
其他好文 时间:
2015-06-23 17:44:18
阅读次数:
99
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-06-23 15:50:51
阅读次数:
92
题目描述:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive in...
分类:
移动开发 时间:
2015-06-23 09:57:52
阅读次数:
197
Valid Sudoku
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are fil...
分类:
其他好文 时间:
2015-06-22 11:13:05
阅读次数:
141
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 subtrees of every node never diffe...
分类:
其他好文 时间:
2015-06-22 09:55:14
阅读次数:
139