随笔分类 -  leetcode

摘要:Question 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. 阅读全文
posted @ 2017-10-31 15:25 清水汪汪 阅读(128) 评论(0) 推荐(0) 编辑
摘要:Question Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run time complexity? How and why? Write 阅读全文
posted @ 2017-10-31 13:39 清水汪汪 阅读(180) 评论(0) 推荐(0) 编辑
摘要:Question Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given1 1 2, return1 2. Given1 1 2 3 3 阅读全文
posted @ 2017-10-31 12:09 清水汪汪 阅读(118) 评论(0) 推荐(0) 编辑
摘要:Question Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, 阅读全文
posted @ 2017-10-31 12:05 清水汪汪 阅读(122) 评论(0) 推荐(0) 编辑
摘要:Question Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. Solution 这个题目可以借鉴 "Leet 阅读全文
posted @ 2017-10-31 11:46 清水汪汪 阅读(191) 评论(0) 推荐(0) 编辑
摘要:Question Given n non negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in 阅读全文
posted @ 2017-10-31 10:57 清水汪汪 阅读(126) 评论(0) 推荐(0) 编辑
摘要:Question Given a non empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time 阅读全文
posted @ 2017-10-20 11:05 清水汪汪 阅读(241) 评论(0) 推荐(0) 编辑
摘要:Question Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three 阅读全文
posted @ 2017-10-20 09:48 清水汪汪 阅读(116) 评论(0) 推荐(0) 编辑
摘要:Question Sort a linked list in O(n log n) time using constant space complexity. Solution 分析,时间复杂度要求为nlogn,因此得考虑归并排序,但是空间必须为常量,因此得注意指针的操作。 Code 阅读全文
posted @ 2017-10-19 22:30 清水汪汪 阅读(119) 评论(0) 推荐(0) 编辑
摘要:Question Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Return 阅读全文
posted @ 2017-10-03 20:14 清水汪汪 阅读(133) 评论(0) 推荐(0) 编辑
摘要:Question Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run time complexity? How and why? 阅读全文
posted @ 2017-10-02 13:36 清水汪汪 阅读(111) 评论(0) 推荐(0) 编辑
摘要:Question Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] 阅读全文
posted @ 2017-09-30 16:37 清水汪汪 阅读(84) 评论(0) 推荐(0) 编辑
摘要:Question Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If n is odd, you can replace n with either 阅读全文
posted @ 2017-09-30 16:29 清水汪汪 阅读(112) 评论(0) 推荐(0) 编辑
摘要:Question You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins tha 阅读全文
posted @ 2017-09-30 15:41 清水汪汪 阅读(149) 评论(0) 推荐(0) 编辑
摘要:Question Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of 阅读全文
posted @ 2017-09-29 10:09 清水汪汪 阅读(148) 评论(0) 推荐(0) 编辑
摘要:Question Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) 阅读全文
posted @ 2017-09-28 17:19 清水汪汪 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Question Given n non negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in 阅读全文
posted @ 2017-09-27 14:17 清水汪汪 阅读(121) 评论(0) 推荐(0) 编辑
摘要:Question Given an encoded string, return it's decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brac 阅读全文
posted @ 2017-09-24 22:32 清水汪汪 阅读(217) 评论(0) 推荐(0) 编辑
摘要:Question Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one of 阅读全文
posted @ 2017-09-24 21:24 清水汪汪 阅读(166) 评论(0) 推荐(0) 编辑
摘要:Question Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n is positive and will fit within the range 阅读全文
posted @ 2017-09-24 19:17 清水汪汪 阅读(177) 评论(0) 推荐(0) 编辑