- 博客(8)
- 资源 (2)
- 收藏
- 关注
原创 [LeetCode] Linked List Cycle
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? /** * Definition for singly-linked list. * struct ListNode { * int val; *
2014-03-18 00:19:28 341
原创 [LeetCode] Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. class Solution { public: int numTrees
2014-03-18 00:02:07 377
原创 [LeetCode] Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on
2014-03-16 12:25:41 413
原创 [LeetCode] Reverse Integer
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 class Solution { public: int reverse(int x) { int s=0; int a=0; if(x<0)
2014-03-16 12:09:11 347
原创 [LeetCode] 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. /** * Def
2014-03-16 12:00:54 367
原创 [LeetCode] 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 tree
2014-03-16 11:43:12 344
原创 [LeetCode] Single Number
Given an array of integers, every element appears twice except for one. Find that single one. class Solution { public: int singleNumber(int A[], int n) { int s=0; int i;
2014-03-16 11:33:49 366
[MATLAB揭秘].David.McMahon
2012-04-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人