知行合一

BUILD YOUR WORLD

Leetcode_162_Find Peak Element

A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde...

2016-04-25 22:31:24

阅读数:272

评论数:0

Leetcode_226_Invert Binary Tree

Invert a binary tree. 题意:反转一棵二叉树 思路:每次交换即可 坑:暂无 代码:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode...

2016-04-22 09:47:19

阅读数:272

评论数:0

Leetcode_104_Maximum Depth of Binary Tree

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...

2016-04-20 18:08:51

阅读数:280

评论数:0

Leetcode_338_Counting Bits

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and ...

2016-04-20 18:06:26

阅读数:325

评论数:0

Leetcode_258_Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: ...

2016-04-17 11:15:17

阅读数:305

评论数:0

Leetcode_326_Power of Three

Given an integer, write a function to determine if it is a power of three.Follow up: Could you do it without using any loop / recursion?题意:判断一个数是否为3...

2016-04-13 22:45:25

阅读数:301

评论数:0

Leetcode_144_Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 ...

2016-04-13 17:39:22

阅读数:272

评论数:0

Leetcode_94_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 ...

2016-04-12 22:37:26

阅读数:278

评论数:0

Leetcode_171_Excel Sheet Column Number

Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example:A -&...

2016-04-12 18:06:11

阅读数:173

评论数:0

Leetcode_168_Excel Sheet Column Number

Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A 2 -> B 3 -> C ... 26 -> Z ...

2016-04-12 17:55:19

阅读数:145

评论数:0

Leetcode_86_Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the ...

2016-04-11 17:37:18

阅读数:122

评论数:0

Leetcode_105_Construct Binary Tree from Preorder and Inorder Traversal

这个题和上一个题差不多是一样的,只不过后序变成了前序,但是思路还是一样的,这次直接顺着上次的思路写的,一遍A了,算是记住这种算法了。/** * Definition for a binary tree node. * struct TreeNode { * int val; * ...

2016-04-11 15:10:49

阅读数:290

评论数:0

Leetcode_106_Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.根据中序和后序遍历确定...

2016-04-09 09:59:39

阅读数:175

评论数:0

Leetcode_78_Subsets

Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order. The solution set must...

2016-04-07 22:18:35

阅读数:173

评论数:0

Leetcode_300_Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest...

2016-04-07 19:28:10

阅读数:189

评论数:0

Leetcode_231_Power of Two

Given an integer, write a function to determine if it is a power of two. 原题链接思路:如果那个数是2的幂,那么二进制表示中一定只有一个1。 例如 1:0001 2:0010 4:0100 … 所以就想按位来检验是否为2...

2016-04-07 19:12:07

阅读数:152

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭