leetcode
文章平均质量分 77
zhengnanc
这个作者很懒,什么都没留下…
展开
-
Given an array of integers, every element appears twice except for one. Find that single one.
Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?原创 2014-07-10 11:14:00 · 652 阅读 · 0 评论 -
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 return [1,2,3]. Note: Recursive soluti原创 2014-07-10 13:19:28 · 254 阅读 · 0 评论 -
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 leaf node. /** * Definition for binary原创 2014-07-10 16:43:52 · 232 阅读 · 0 评论 -
Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value. /** * Definitio原创 2014-07-10 18:34:50 · 242 阅读 · 0 评论 -
Reverse Integer 被自己蠢哭了!
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you thought about this? Here are some good questions to ask before coding. Bonus points for you原创 2014-07-10 19:08:17 · 304 阅读 · 0 评论 -
Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),原创 2014-07-11 11:24:39 · 279 阅读 · 0 评论