上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 37 下一页

2014年6月12日

LeetCode ---- Merge Sorted Array

摘要: 题目链接Problem discriptionGiven 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 t... 阅读全文

posted @ 2014-06-12 10:31 Stomach_ache 阅读(142) 评论(0) 推荐(0)

2014年6月10日

Hdu 1007 最近点对

摘要: 题目链接Quoit DesignTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 29547Accepted Submission(s): 7741... 阅读全文

posted @ 2014-06-10 23:23 Stomach_ache 阅读(148) 评论(0) 推荐(0)

LeetCode --- Populating Next Right Pointers in Each Node II

摘要: 题目链接Problem description:Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would you... 阅读全文

posted @ 2014-06-10 14:55 Stomach_ache 阅读(149) 评论(0) 推荐(0)

LeetCode --- Populating Next Right Pointers in Each Node

摘要: 题目链接Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next po... 阅读全文

posted @ 2014-06-10 14:11 Stomach_ache 阅读(111) 评论(0) 推荐(0)

2014年6月8日

LeetCode --- Remove Element

摘要: 题目链接题意:给出长度为n的数组,和整数elem, 要求删除数组中存在的elem,返回最终的数组长度。附上代码: 1 class Solution { 2 public: 3 int removeElement(int A[], int n, int elem) { 4 //... 阅读全文

posted @ 2014-06-08 21:05 Stomach_ache 阅读(155) 评论(0) 推荐(0)

LeetCode --- Pow(x, n)

摘要: 题目链接题意:实现pos(x, n)功能, 其中x为double类型,n为int类型附上代码: 1 class Solution { 2 public: 3 double pow(double x, int n) { 4 // handle several particula... 阅读全文

posted @ 2014-06-08 20:39 Stomach_ache 阅读(148) 评论(0) 推荐(0)

LeetCode --- Rotate Image

摘要: 题目链接题意: 给出 n * n的矩阵,要求将矩阵顺时针旋转90°(不使用额外空间) 1 /* 2 Basically, divide the array into 4 along the diagonals, 3 then for each element in the top ... 阅读全文

posted @ 2014-06-08 17:23 Stomach_ache 阅读(154) 评论(0) 推荐(0)

LeetCode --- Balanced Binary Tree

摘要: 题目链接题意: 给定一棵二叉树, 判断是否为平衡二叉树, 这里的平衡二叉树指的是:每个结点的左右子树的深度之差不超过1。附上代码: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * ... 阅读全文

posted @ 2014-06-08 14:01 Stomach_ache 阅读(151) 评论(0) 推荐(0)

LeetCode --- Minimum Depth of Binary Tree

摘要: 题目链接求二叉树最小深度,最小深度指的是:从根节点走到最近的叶子结点的最短长度附上代码: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6... 阅读全文

posted @ 2014-06-08 12:31 Stomach_ache 阅读(126) 评论(0) 推荐(0)

2014年6月5日

LeetCode --- Validate Binary Search Tree

摘要: 题目链接判断一颗二叉树是否是二叉搜索树(二叉排序树),也就是BST如果该二叉树是BST, 那么对其中序遍历,所得序列一定是单调递增的(不考虑有重复数值的情况)附上代码: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 *... 阅读全文

posted @ 2014-06-05 12:19 Stomach_ache 阅读(97) 评论(0) 推荐(0)

上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 37 下一页

导航