上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 80 下一页
摘要: 虽然题目中说是easy, 但是我提交了10遍才过,就算hard吧。主要是很多情况我都没有考虑到。并且有的时候我的规则和答案中的规则不同。答案的规则:1.前导空格全部跳过 “ 123” = 1232.正负号要考虑 “+123” = 123 “-123” = -1233.数字的前导0要跳过 “-0... 阅读全文
posted @ 2014-12-02 12:05 匡子语 阅读(303) 评论(0) 推荐(0)
摘要: There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi... 阅读全文
posted @ 2014-12-01 14:00 匡子语 阅读(287) 评论(0) 推荐(0)
摘要: You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati... 阅读全文
posted @ 2014-12-01 12:27 匡子语 阅读(212) 评论(0) 推荐(0)
摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2014-11-28 14:41 匡子语 阅读(172) 评论(0) 推荐(0)
摘要: Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文
posted @ 2014-11-28 11:36 匡子语 阅读(195) 评论(0) 推荐(0)
摘要: Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.找树的最大路径和 注意路径可以从任意点起始和结束。我发现我真的还挺擅长树的题目的,递归不难。就是因为有个... 阅读全文
posted @ 2014-11-27 22:46 匡子语 阅读(218) 评论(0) 推荐(0)
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.有序数组变二叉平衡搜索树,不难,递归就行。每次先序建立根节点(取最中间的数),然后用子区间划分左右子树。一... 阅读全文
posted @ 2014-11-27 21:42 匡子语 阅读(197) 评论(0) 推荐(0)
摘要: Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not co... 阅读全文
posted @ 2014-11-23 16:58 匡子语 阅读(239) 评论(0) 推荐(0)
摘要: 二叉树的后序遍历用标记右子树vector的方法vector postorderTraversal(TreeNode *root) { vector ans; vector stack; vector isRight; stack.push_b... 阅读全文
posted @ 2014-11-23 14:57 匡子语 阅读(253) 评论(0) 推荐(0)
摘要: 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 le... 阅读全文
posted @ 2014-11-23 13:08 匡子语 阅读(198) 评论(0) 推荐(0)
上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 80 下一页