摘要: int curInc;HashMap incMap;Stack stack;public SuperStack() { this.curInc = 0; this.incMap = new HashMap(); this.stack = new Stack();} p... 阅读全文
posted @ 2015-10-25 02:23 airforce 阅读(336) 评论(0) 推荐(0) 编辑
摘要: Problem:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all... 阅读全文
posted @ 2015-10-02 04:42 airforce 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Problem:Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Fo... 阅读全文
posted @ 2015-10-01 08:23 airforce 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Problem:Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You ... 阅读全文
posted @ 2015-09-26 10:32 airforce 阅读(256) 评论(0) 推荐(0) 编辑
摘要: Problem:Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators a... 阅读全文
posted @ 2015-09-20 23:18 airforce 阅读(457) 评论(0) 推荐(0) 编辑
摘要: Problem:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible repres... 阅读全文
posted @ 2015-09-20 22:16 airforce 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Problem:Given an unsorted arraynums, reorder itin-placesuch thatnums[0] = nums[2] = nums[2] = nums[i+1]Note: i is an odd number. Solution 1:public cla... 阅读全文
posted @ 2015-09-20 12:01 airforce 阅读(498) 评论(0) 推荐(0) 编辑
摘要: Problem:Given a non-empty binary search tree and a target value, findkvalues in the BST that are closest to the target.Note:Given target value is a fl... 阅读全文
posted @ 2015-09-20 10:58 airforce 阅读(406) 评论(0) 推荐(0) 编辑
摘要: Problem:Numbers can be regarded as product of its factors. For example,8 = 2 x 2 x 2; = 2 x 4.Write a function that takes an integernand return all p... 阅读全文
posted @ 2015-09-19 23:29 airforce 阅读(3274) 评论(0) 推荐(0) 编辑
摘要: Problem:The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid ... 阅读全文
posted @ 2015-09-19 09:28 airforce 阅读(269) 评论(0) 推荐(0) 编辑