![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 62
小屁孩2013
这个作者很懒,什么都没留下…
展开
-
[LeetCode] Single Number
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 wit原创 2014-04-29 20:46:34 · 568 阅读 · 0 评论 -
[LeetCode] Reverse Integer
Problem : Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321原创 2014-04-29 22:56:53 · 558 阅读 · 0 评论 -
[LeetCode] Same Tree
Problem : 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.原创 2014-04-30 14:12:00 · 500 阅读 · 0 评论 -
[LeetCode] Remove Duplicates from Sorted List
Problem : Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 1.C++版 /*原创 2014-04-30 19:07:32 · 680 阅读 · 0 评论 -
[LeetCode] Climbing Stairs
Problem : You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?原创 2014-04-30 19:13:37 · 461 阅读 · 0 评论 -
[LeetCode] Balanced Binary Tree
Problem : 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 no原创 2014-05-01 01:01:59 · 604 阅读 · 0 评论 -
[LeetCode] Linked List Cycle
Problem : Given a linked list, determine if it has a cycle in it. Follow up : Can you solve it without using extra space?原创 2014-04-30 19:48:15 · 500 阅读 · 0 评论 -
[LeetCode] Binary Tree Inorder Traversal
Problem : Given a binary tree, return the inorder traversal of its nodes' values. For example : Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2]. Note: Recursive so原创 2014-04-30 14:26:47 · 371 阅读 · 0 评论 -
[LeetCode] Maximum Depth of Binary Tree
Problem : 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.原创 2014-04-29 21:17:33 · 2058 阅读 · 0 评论 -
[LeetCode] Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place w原创 2014-04-30 21:22:42 · 429 阅读 · 0 评论 -
[LeetCode] Evaluate Reverse Polish Notation
Problem : Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another expression. Some examples: ["原创 2014-05-01 22:16:41 · 600 阅读 · 0 评论 -
[LeetCode] Sqrt(x)
Problem : Implement int sqrt(int x). Compute and return the square root of x. 1.C++版原创 2014-04-29 22:46:18 · 525 阅读 · 0 评论 -
[LeetCode] Search Insert Position
Problem : Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates原创 2014-04-30 14:29:54 · 468 阅读 · 0 评论 -
[LeetCode] Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array. Note : You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fr原创 2014-05-01 00:32:53 · 582 阅读 · 0 评论 -
[LeetCode] Remove Element
Problem : Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn't matter what you leave beyond the ne原创 2014-04-30 20:40:00 · 349 阅读 · 0 评论 -
[LeetCode] Maximum Subarray
Problem : Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [原创 2014-04-30 19:18:31 · 469 阅读 · 0 评论 -
[LeetCode] Binary Tree Preorder Traversal
Problem : 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 s原创 2014-04-30 14:19:54 · 460 阅读 · 0 评论