Fork me on GitHub
摘要: Queue是java中实现队列的接口,它总共只有6个方法,我们一般只用其中3个就可以了。Queue的实现类有LinkedList和PriorityQueue。最常用的实现类是LinkedList。 压入元素(添加):add()、offer() 相同:未超出容量,从队尾压入元素,返回压入的那个元素。区 阅读全文
posted @ 2019-08-05 15:22 gentleKay 阅读(306) 评论(0) 推荐(0) 编辑
摘要: StackDemo: 阅读全文
posted @ 2019-08-05 15:18 gentleKay 阅读(115) 评论(0) 推荐(0) 编辑
摘要: /** * * @author gentleKay * Given a linked list, swap every two adjacent nodes and return its head. * For example, * Given1->2->3->4, you should retur 阅读全文
posted @ 2019-08-05 10:49 gentleKay 阅读(170) 评论(0) 推荐(0) 编辑
摘要: /** * * @author gentleKay * Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. * 阅读全文
posted @ 2019-08-05 10:46 gentleKay 阅读(116) 评论(0) 推荐(0) 编辑