摘要:
int curInc;HashMap incMap;Stack stack;public SuperStack() { this.curInc = 0; this.incMap = new HashMap(); this.stack = new Stack();} p... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
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 ... 阅读全文
摘要:
Problem:Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators a... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
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 ... 阅读全文