上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 18 下一页
摘要: Description:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution se... 阅读全文
posted @ 2015-10-11 23:21 Pickle 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Description:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You ma... 阅读全文
posted @ 2015-10-08 17:47 Pickle 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Description:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You ma... 阅读全文
posted @ 2015-10-08 10:53 Pickle 阅读(183) 评论(0) 推荐(0) 编辑
摘要: Description:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one tra... 阅读全文
posted @ 2015-10-07 23:32 Pickle 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Description:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum e... 阅读全文
posted @ 2015-10-07 23:08 Pickle 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Mahout中对协同过滤算法进行了封装,看一个简单的基于用户的协同过滤算法。基于用户:通过用户对物品的偏好程度来计算出用户的在喜好上的近邻,从而根据近邻的喜好推测出用户的喜好并推荐。图片来源程序中用到的数据都存在MySQL数据库中,计算结果也存在MySQL中的对应用户表中。package com.m... 阅读全文
posted @ 2015-10-05 22:56 Pickle 阅读(7921) 评论(1) 推荐(1) 编辑
摘要: 最近在一个项目中需要对文件进行自动的解压缩,Java提供了这种支持,还是挺好用的。工具包封装在java.util.zip中。1.首先是多个文件压缩成一个ZIP文件思路:用一个ZipOutputStream包装一个目的ZIP文件--->遍历文件数组:对每一个文件创建一个ZipEntry并put进Zip... 阅读全文
posted @ 2015-10-05 21:53 Pickle 阅读(9600) 评论(0) 推荐(0) 编辑
摘要: Description:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.给一个升序有序的数组,构建一个平衡的二叉查找树。要平衡就要找中间的数来做头结点,递... 阅读全文
posted @ 2015-10-01 16:29 Pickle 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Description:Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0... 阅读全文
posted @ 2015-10-01 14:02 Pickle 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Description:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.noting to say.public class Solut... 阅读全文
posted @ 2015-10-01 12:58 Pickle 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Description:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and o... 阅读全文
posted @ 2015-10-01 11:21 Pickle 阅读(250) 评论(0) 推荐(0) 编辑
摘要: Description:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are s... 阅读全文
posted @ 2015-09-30 20:47 Pickle 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Description:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,... 阅读全文
posted @ 2015-09-30 19:03 Pickle 阅读(234) 评论(0) 推荐(0) 编辑
摘要: Description:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were in... 阅读全文
posted @ 2015-09-30 10:44 Pickle 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Description:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each... 阅读全文
posted @ 2015-09-29 22:22 Pickle 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 常见的前序、中序、后序都很常见,最近用到了按层遍历,记录一下:思路:用一个队列来作为辅助空间。依次存储头结点,左节点和右节点。每次循环输出节点的值,直到队列为空这样一来就利用了队列先进先出的性质实现了非递归按层遍历二叉树。具体实现:void levelOrderTraverse(const BiTr... 阅读全文
posted @ 2015-09-29 21:32 Pickle 阅读(636) 评论(0) 推荐(0) 编辑
摘要: Description:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexcept... 阅读全文
posted @ 2015-09-29 17:49 Pickle 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Description:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return... 阅读全文
posted @ 2015-09-28 23:06 Pickle 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Description:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.n皇后问题:每两个皇后之间不能... 阅读全文
posted @ 2015-09-28 23:01 Pickle 阅读(312) 评论(0) 推荐(0) 编辑
摘要: Description:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?在不借助辅助空间的情况下判断一个链表是否存在回路。可以用两个... 阅读全文
posted @ 2015-09-28 17:27 Pickle 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Description:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3retur... 阅读全文
posted @ 2015-09-28 00:23 Pickle 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Description:Given an array of numbersnums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the tw... 阅读全文
posted @ 2015-09-27 22:32 Pickle 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Description:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You ma... 阅读全文
posted @ 2015-09-27 17:17 Pickle 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Description:Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf pat... 阅读全文
posted @ 2015-09-27 16:56 Pickle 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Description:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails t... 阅读全文
posted @ 2015-09-26 22:18 Pickle 阅读(160) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 18 下一页