码迷,mamicode.com
首页 >  
搜索关键字:算法面试    ( 461个结果
LeetCode: Best Time to Buy and Sell Stock III [123]
【题目】 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. Note: You may not engage in multiple transactions at the same time (i...
分类:其他好文   时间:2014-06-24 23:28:43    阅读次数:223
LeetCode: Binary Tree Maximum Path Sum [124]
【题目】 Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example: Given the below binary tree, 1 / 2 3 Return 6. 【题意】 给定一棵二叉树,找出其中路径和最大的路径,然会返回最大路径和。 本题中的路径不是从根节点到叶子节点这样的传统的路...
分类:其他好文   时间:2014-06-24 20:42:59    阅读次数:268
LeetCode: Best Time to Buy and Sell Stock II [122]
【题目】 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 and sell one share of the stock multiple times). H...
分类:其他好文   时间:2014-06-24 19:40:53    阅读次数:240
LeetCode: Valid Palindrome [125]
【题目】 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 palindrome. Note: Have you consider that the string m...
分类:其他好文   时间:2014-06-24 15:35:07    阅读次数:150
LeetCode: Binary Tree Level Order Traversal II [107]
【题目】 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}, 3 / 9 20 / 15 7 return its b...
分类:其他好文   时间:2014-06-20 09:42:30    阅读次数:224
LeetCode: Triangle [120]
【题目】 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], [4,1,8,3] ] The minimum path sum from top to...
分类:其他好文   时间:2014-06-08 17:52:45    阅读次数:235
LeetCode: Populating Next Right Pointers in Each Node II [117]
【题目】 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. For example, Given the following binary tre...
分类:其他好文   时间:2014-06-08 15:46:22    阅读次数:303
LeetCode: Pascal's Triangle II [119]
【题目】 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, k从0开始,返回该索引指向的杨辉三角的行 要求只能使用O(k)的额外空间 【思路】 ...
分类:其他好文   时间:2014-06-08 15:46:02    阅读次数:272
LeetCode: Best Time to Buy and Sell Stock [121]
【题目】 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), design an algorithm to find the maximum profit. ...
分类:其他好文   时间:2014-06-08 15:11:58    阅读次数:298
LeetCode: Pascal's Triangle [118]
【题目】 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] ] 【题意】 给定整数numRows, 要求生成杨辉三角的前numRows行 【思路】 杨辉三角有以下特点: 1. 第n行有n个元素 ...
分类:其他好文   时间:2014-06-08 09:17:06    阅读次数:196
461条   上一页 1 ... 34 35 36 37 38 ... 47 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!