上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 21 下一页

2016年6月6日

Triangle Count

摘要: Given an array of integers, how many three numbers can be found in the array, so that we can build an triangle whose three edges length is the three n 阅读全文

posted @ 2016-06-06 15:27 Sheryl Wang 阅读(456) 评论(0) 推荐(0) 编辑

Two Sum II

摘要: Given an array of integers, find how many pairs in the array such that their sum is bigger than a specific target number. Please return the number of 阅读全文

posted @ 2016-06-06 15:07 Sheryl Wang 阅读(174) 评论(0) 推荐(0) 编辑

2016年6月2日

Subarray Sum

摘要: 给定一个整数数组,找到和为零的子数组。你的代码应该返回满足要求的子数组的起始位置和结束位置。比如给出 [-3, 1, 2, -3, 4],返回[0, 2] 或者 [1, 3]. Lintcode上的一道题目,这一题我开始想到的是brute force的方法,求出所有子数组,并判断和是否为0。子数组一 阅读全文

posted @ 2016-06-02 22:36 Sheryl Wang 阅读(379) 评论(0) 推荐(0) 编辑

Intersection of Two Arrays

摘要: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element i 阅读全文

posted @ 2016-06-02 22:19 Sheryl Wang 阅读(145) 评论(0) 推荐(0) 编辑

2016年6月1日

Reorder List

摘要: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For 阅读全文

posted @ 2016-06-01 21:46 Sheryl Wang 阅读(138) 评论(0) 推荐(0) 编辑

2016年5月31日

Convert Sorted List to Binary Search Tree

摘要: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 看到这题我想到的直接的做法是每次找到链表的中间结点(slow 和 fast双指针 阅读全文

posted @ 2016-05-31 22:23 Sheryl Wang 阅读(143) 评论(0) 推荐(0) 编辑

2016年5月30日

Remove Duplicates from Sorted List II

摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2 阅读全文

posted @ 2016-05-30 22:07 Sheryl Wang 阅读(168) 评论(0) 推荐(0) 编辑

Partition List

摘要: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文

posted @ 2016-05-30 20:12 Sheryl Wang 阅读(123) 评论(0) 推荐(0) 编辑

Linked List Cycle II

摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:Can you 阅读全文

posted @ 2016-05-30 16:32 Sheryl Wang 阅读(116) 评论(0) 推荐(0) 编辑

Sort List

摘要: Sort a linked list in O(n log n) time using constant space complexity. 题目要求用 O(n log n)的时间复杂度和常数的空间复杂度来进行链表排序。 O(nlogn)的排序算法有堆排,快排,归并排序等,一开始我准备采用快排,后来 阅读全文

posted @ 2016-05-30 15:40 Sheryl Wang 阅读(166) 评论(0) 推荐(0) 编辑

上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 21 下一页

导航