上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g 阅读全文
posted @ 2017-04-09 21:30 蓦然闻声 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 思路:递归。先将左子树反转,再将右子树反转,然后让root->left指向反转后的右子树,root->right指向反转后的左子树。 阅读全文
posted @ 2017-04-09 21:29 蓦然闻声 阅读(79) 评论(0) 推荐(0) 编辑
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2017-04-09 21:29 蓦然闻声 阅读(64) 评论(0) 推荐(0) 编辑
摘要: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at 阅读全文
posted @ 2017-04-09 21:26 蓦然闻声 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two di 阅读全文
posted @ 2017-04-09 21:25 蓦然闻声 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime comple 阅读全文
posted @ 2017-04-09 21:24 蓦然闻声 阅读(90) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2017-04-09 21:24 蓦然闻声 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2017-04-09 21:20 蓦然闻声 阅读(140) 评论(0) 推荐(0) 编辑
摘要: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Input: x = 1, y = 4 Output: 2 Expl 阅读全文
posted @ 2017-04-09 21:19 蓦然闻声 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 思路:设原始周长为4*节点数,每当出现一次相邻的情况,原始周长会减2。 阅读全文
posted @ 2017-04-09 21:18 蓦然闻声 阅读(107) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页