- 博客(23)
- 资源 (18)
- 收藏
- 关注
原创 《leetCode》:Sum Root to Leaf Numbers
题目Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the total sum of
2016-02-28 20:05:57 473
原创 《leetCode》:Valid Palindrome
题目Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a palin
2016-02-28 19:22:47 394
转载 《 搜索引擎的使用技巧》
原文地址:http://b.xinshengdaxue.com/C04.html 1 使用“本尊”最好使用 http://www.google.com/ncr NCR: No Country Redirection,而不是http://www.google.com.hk;有时,直接输入http://www.google.com也会被自动转到“本地Google”,比如,我用日本的 VPN,浏览器就会
2016-02-28 17:23:57 739
原创 《leetCode》:Best Time to Buy and Sell Stock III
题目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 at most two transactions.思路一:报超时错误思路:分而治之,将pric
2016-02-28 11:44:54 450
原创 《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 one a
2016-02-28 11:24:42 372
原创 《leetCode》:Best Time to Buy and Sell Stock
题目Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), de
2016-02-28 10:44:26 428
原创 《leetCode》:Triangle
题目Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,5,7]
2016-02-28 10:16:20 363
原创 《leetCode》: Pascal's Triangle II
题目Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?思路一由于题目只需要得到杨辉三角的第k层的元素。由
2016-02-27 21:13:01 394
原创 《leetCode》: Pascal's Triangle
题目Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]思路刚看到这个题目的时候,不知道这个三角形是什么也,百度了才知道这个就是
2016-02-27 21:03:53 476
原创 《leetCode》:Populating Next Right Pointers in Each Node II
题目Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extra space
2016-02-27 20:31:35 368
原创 《leetCode》:Populating Next Right Pointers in Each Node
题目Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If there
2016-02-27 20:25:39 338
原创 《leetCode》:Flatten Binary Tree to Linked List
题目Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1 \ 2
2016-02-27 18:58:40 374
原创 《leetCode》:Path Sum II
题目Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \
2016-02-26 16:51:47 470
原创 《leetCode》:Path Sum
题目Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum =
2016-02-26 15:12:11 373
原创 《leetCode》:Minimum Depth of Binary Tree
题目Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.思路实现代码如下:/** * Definition for a binary t
2016-02-26 11:37:51 373
原创 《leetCode》:Balanced Binary Tree
题目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 node never differ
2016-02-26 11:19:25 394
原创 《leetCode》:Binary Tree Zigzag Level Order Traversal
题目Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary tree
2016-02-26 10:42:30 441
原创 《leetCode》:Convert Sorted List to Binary Search Tree
题目Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.思路比较晚了,明天来实现
2016-02-25 22:26:16 403
原创 《leetCode》:Convert Sorted Array to Binary Search Tree
题目Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路思路:将数组以中心点分割为两部分,中心点为父节点,左边就为该节点的左子树,右边为该节点的右子树;实现代码如下:/** * Definition for a binary tree node. *
2016-02-25 22:22:51 351
原创 《leetCode》:Binary Tree Level Order Traversal II
题目Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7},
2016-02-25 21:29:28 365
原创 《leetCode》:Construct Binary Tree from Inorder and Postorder Traversal
题目Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.思路在上篇博文中,是利用前序遍历和中序遍历的结果来进行二叉树的构造,然后基于这样的思路就开始做这个题目,发现,利用原有的思路
2016-02-25 19:59:50 388
原创 《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.思路这个题目再《剑指Offer》中做过,具体见http://blog.csdn.net/u010412719/article/
2016-02-25 16:34:27 350
原创 《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.思路思路:父节点的深度为子结点深度+1 ;实现代码如下:第一个版本int max
2016-02-25 15:26:16 502
matlab2012b与vs2010交叉调用时的编译环境设置
2015-08-25
读取心电图txt格式文件数据并且显示的app
2015-05-15
MIT-BIH的心电图数据将V5导联的数据提取出来的txt的数据文件
2015-05-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人