LeetCode
greenapple_shan
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
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 without using ext原创 2014-05-06 18:42:40 · 632 阅读 · 0 评论 -
LeetCode--Linked List Cycle
Linked List Cycle Total Accepted: 17148 Total Submissions: 49300My SubmissionsGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra sp原创 2014-05-14 22:17:31 · 862 阅读 · 0 评论 -
LeetCode--Single Number II
Single Number II Total Accepted: 14472 Total Submissions: 44420My SubmissionsGiven an array of integers, every element appears three times except for one. Find that single one.Note:Y原创 2014-05-14 21:38:46 · 828 阅读 · 0 评论 -
Leetcode: 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 / 3return [1,2,3].Note: Recursive soluti转载 2014-05-14 14:40:55 · 663 阅读 · 0 评论 -
LeetCode--Search Insert Position
Search Insert Position Total Accepted: 14091 Total Submissions: 41005My SubmissionsGiven a sorted array and a target value, return the index if the target is found. If not, return the in原创 2014-05-10 11:25:56 · 1024 阅读 · 0 评论 -
LeetCode--Same Tree
Same Tree Total Accepted: 16072 Total Submissions: 38790My SubmissionsGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal i原创 2014-05-13 09:46:44 · 920 阅读 · 0 评论 -
LeetCode--Maximum Depth of Binary Tree
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti原创 2014-05-07 17:15:20 · 704 阅读 · 0 评论 -
LeetCode--online portal for IT interview
LeetCode--online portal for IT interviewhttp://leetcode.com原创 2014-02-13 11:50:08 · 816 阅读 · 0 评论 -
leetcode 13:symmetric tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f转载 2014-05-16 14:31:24 · 620 阅读 · 0 评论 -
LeetCode--Reverse Integer
//#include #include #include //using namespace std;//const int MAXN=10;//int Stack[MAXN];stack s;class Solution {public: int getNumber(int x) { //int lengthOfStack=0;原创 2014-05-09 20:49:50 · 901 阅读 · 0 评论 -
LeetCode--Binary Tree Level Order Traversal
Binary Tree Level Order Traversal Total Accepted: 12441 Total Submissions: 40879My SubmissionsGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left t原创 2014-05-16 10:16:14 · 926 阅读 · 0 评论 -
LeetCode--Symmetric Tree
对于本题,想到一个中序遍历后,判别是否为回文串的方法,却WA多次class Solution {public: vector vectorValue; void inOrder(TreeNode* root) { if(root!=NULL) { inOrder(root->left);原创 2014-05-16 14:27:12 · 888 阅读 · 0 评论 -
LeetCode--Minimum Depth of Binary Tree
本文先参考了http://www.cnblogs.com/remlostime/archive/2012/11/12/2766608.html法一,递归/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; *原创 2014-05-15 15:44:12 · 863 阅读 · 0 评论 -
经典面试题之单链表找环
大概的题意是,给出一个单向链表的头节点,求这么链表是否有环。有环的定义是,链表的尾节点指向了链接中间的某个节点。单链表的定义如下:1234structNode { Node(): next(NULL) {} Node *next;};这道题目还有一些变种,比如求链接的长度,求链表的尾节点转载 2014-05-14 22:01:41 · 813 阅读 · 0 评论 -
LeetCode--Binary Tree Preorder Traversal
Binary Tree Preorder Traversal Total Accepted: 18022 Total Submissions: 51784My SubmissionsGiven a binary tree, return the preorder traversal of its nodes' values.For example:Given b原创 2014-05-14 12:47:02 · 889 阅读 · 0 评论
分享