摘要: Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both?反转链表。有两种方法 阅读全文
posted @ 2018-10-27 13:38 杜王町上班族 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], wh 阅读全文
posted @ 2018-10-27 10:49 杜王町上班族 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middl 阅读全文
posted @ 2018-10-25 16:32 杜王町上班族 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: 去重,因为已经排序好,直接比较不同的结点的数据域放进去就行。 阅读全文
posted @ 2018-10-24 16:03 杜王町上班族 阅读(138) 评论(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. E 阅读全文
posted @ 2018-10-23 20:18 杜王町上班族 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Y 阅读全文
posted @ 2018-10-20 19:23 杜王町上班族 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Let's call an array A a mountain if the following properties hold: A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[ 阅读全文
posted @ 2018-10-18 23:33 杜王町上班族 阅读(86) 评论(0) 推荐(0) 编辑
摘要: Given a list of sorted characters letterscontaining only lowercase letters, and given a target letter target, find the smallest element in the list th 阅读全文
posted @ 2018-10-17 21:40 杜王町上班族 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If targetexists, t 阅读全文
posted @ 2018-10-17 17:08 杜王町上班族 阅读(113) 评论(0) 推荐(0) 编辑
摘要: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number 阅读全文
posted @ 2018-10-17 00:00 杜王町上班族 阅读(139) 评论(0) 推荐(0) 编辑