上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页
摘要: Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 本题通过前序和中序来推断这 阅读全文
posted @ 2017-02-28 06:52 CodesKiller 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 一般实际生活中我们遇到的算法分为四类: 一>判定性问题 二>最优化问题 三>构造性问题 四>计算性问题 而今天所要总结的算法就是着重解决 最优化问题 《算法之道》对三种算法进行了归纳总结,如下表所示: 标准分治 动态规划 贪心算法 适用类型 通用问题 优化问题 优化问题 子问题结构 每个子问题不同 阅读全文
posted @ 2017-02-28 06:46 CodesKiller 阅读(16564) 评论(2) 推荐(4) 编辑
摘要: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi 阅读全文
posted @ 2017-02-15 14:51 CodesKiller 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2017-02-15 14:34 CodesKiller 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
posted @ 2017-02-15 14:09 CodesKiller 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library functio 阅读全文
posted @ 2017-02-15 13:38 CodesKiller 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: 阅读全文
posted @ 2017-02-15 13:25 CodesKiller 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Numbers can be regarded as product of its factors. For example, Write a function that takes an integer n and return all possible combinations of its f 阅读全文
posted @ 2017-02-13 14:13 CodesKiller 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: [ [2,4], [3,4 阅读全文
posted @ 2017-02-12 07:08 CodesKiller 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho 阅读全文
posted @ 2017-02-11 14:59 CodesKiller 阅读(150) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页