摘要: 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 阅读全文
posted @ 2019-02-09 19:53 JamieLiu 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an integer poswhich represents the posit 阅读全文
posted @ 2019-02-03 22:31 JamieLiu 阅读(174) 评论(0) 推荐(0) 编辑
摘要: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2019-02-02 21:29 JamieLiu 阅读(80) 评论(0) 推荐(0) 编辑
摘要: Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? 解法一:遍历(我的 阅读全文
posted @ 2019-02-02 20:07 JamieLiu 阅读(78) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2019-02-01 22:49 JamieLiu 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文
posted @ 2019-01-31 21:18 JamieLiu 阅读(112) 评论(0) 推荐(0) 编辑
摘要: Given an array nums of n integers, are there elements a, b, c in numssuch that a + b + c = 0? Find all unique triplets in the array which gives the su 阅读全文
posted @ 2019-01-31 20:42 JamieLiu 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Given a collection of intervals, merge all overlapping intervals. Example 1: Example 2: 第一次用java自带的“List” 这个数据结构,好多用法还不清楚,尤其是sort这个自带的排序方法.... 阅读全文
posted @ 2019-01-30 21:40 JamieLiu 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, yo 阅读全文
posted @ 2019-01-30 20:36 JamieLiu 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1. Example 1: Input: 123 Output: " 阅读全文
posted @ 2019-01-29 22:20 JamieLiu 阅读(212) 评论(0) 推荐(0) 编辑