leetcode
文章平均质量分 71
swffsdgasdg
dfgdfsgdgsagvxzvzxvxcqwrwrwerza
展开
-
leetcode-Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the l原创 2014-11-27 02:14:07 · 826 阅读 · 0 评论 -
leetcode-Path Sum
Path Sum Total Accepted: 31405 Total Submissions: 104326My SubmissionsQuestion Solution Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that add原创 2014-11-27 01:12:40 · 804 阅读 · 0 评论 -
leetcode-Minimum Depth of Binary Tree
leetcode-Minimum Depth of Binary Tree原创 2014-11-27 01:56:22 · 845 阅读 · 0 评论 -
leetcode-Binary Tree Level Order Traversal 二叉树层序遍历
leetcode-Binary Tree Level Order Traversal 二叉树层序遍历#include#includeusing namespace std;typedef struct BiTree{ int val; struct BiTree *lchild; struct BiTree *rchild;}BiTree;void main(原创 2014-11-24 21:22:59 · 817 阅读 · 0 评论 -
leetcode-Set Matrix Zeroes
Set Matrix Zeroes Total Accepted: 25064 Total Submissions: 80609 My Submissions Question Solution Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.c原创 2015-01-07 04:25:53 · 790 阅读 · 0 评论 -
链表排序
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *g原创 2015-02-02 20:10:20 · 860 阅读 · 0 评论 -
leetcode-Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.class Solution {private: TreeNode *root; v原创 2015-01-01 22:23:20 · 756 阅读 · 0 评论 -
C递归版的全排列和组合算法
For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].全排列:从1开始递归,然后对2递归,最后对3递归 顺序是先输出 1 2 3 1 3 2 2 1 3 2 3 1 .......原创 2015-02-12 05:26:15 · 2322 阅读 · 0 评论