随笔分类 -  刷题

LeetCode、PAT的刷题笔记
摘要:Best Time to Buy and Sell Stock 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 阅读全文
posted @ 2020-07-13 10:31 十三w~w 阅读(124) 评论(0) 推荐(0)
摘要:Repeated DNA Sequences All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it 阅读全文
posted @ 2020-07-12 19:12 十三w~w 阅读(54) 评论(0) 推荐(0)
摘要:Largest Number Given a list of non negative integers, arrange them such that they form the largest number. Example 1: Input: [10,2] Output: "210" Exam 阅读全文
posted @ 2020-07-12 18:21 十三w~w 阅读(140) 评论(0) 推荐(0)
摘要:Fraction to Recurring Decimal Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If th 阅读全文
posted @ 2020-07-12 16:39 十三w~w 阅读(112) 评论(0) 推荐(0)
摘要:Compare Version Numbers Compare two version numbers version1 and version2. If *version1* > *version2* return 1; if *version1* < *version2* return -1;o 阅读全文
posted @ 2020-07-12 14:31 十三w~w 阅读(140) 评论(0) 推荐(0)
摘要:Maximum Gap Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains le 阅读全文
posted @ 2020-07-08 14:20 十三w~w 阅读(88) 评论(0) 推荐(0)
摘要:Find Peak Element A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak e 阅读全文
posted @ 2020-07-08 12:08 十三w~w 阅读(101) 评论(0) 推荐(0)
摘要:Find Minimum in Rotated Sorted Array II Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4 阅读全文
posted @ 2020-07-07 15:35 十三w~w 阅读(106) 评论(0) 推荐(0)
摘要:Find Minimum in Rotated Sorted Array Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5, 阅读全文
posted @ 2020-07-07 15:18 十三w~w 阅读(77) 评论(0) 推荐(0)
摘要:Maximum Product Subarray Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the larg 阅读全文
posted @ 2020-07-07 14:55 十三w~w 阅读(85) 评论(0) 推荐(0)
摘要:Reverse Words in a String Given an input string, reverse the string word by word. Example 1: Input: "the sky is blue" Output: "blue is sky the" Exampl 阅读全文
posted @ 2020-07-07 14:25 十三w~w 阅读(105) 评论(0) 推荐(0)
摘要:Sort List Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1- 阅读全文
posted @ 2020-07-07 13:46 十三w~w 阅读(102) 评论(0) 推荐(0)
摘要:Evaluate Reverse Polish Notation Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each opera 阅读全文
posted @ 2020-07-07 12:05 十三w~w 阅读(78) 评论(0) 推荐(0)
摘要:Insertion Sort List Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains 阅读全文
posted @ 2020-07-06 22:23 十三w~w 阅读(88) 评论(0) 推荐(0)
摘要:1135 Is It A Red-Black Tree (30 分) There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 p 阅读全文
posted @ 2019-05-10 16:22 十三w~w 阅读(201) 评论(0) 推荐(0)
摘要:1119 Pre- and Post-order Traversals (30 分) Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be dete 阅读全文
posted @ 2019-05-10 16:20 十三w~w 阅读(286) 评论(0) 推荐(0)
摘要:1126 Eulerian Path (25 分) In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit 阅读全文
posted @ 2019-05-10 16:20 十三w~w 阅读(304) 评论(0) 推荐(0)
摘要:1114 Family Property (25 分) This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and 阅读全文
posted @ 2019-05-10 16:19 十三w~w 阅读(293) 评论(0) 推荐(0)
摘要:1112 Stucked Keyboard (20 分) On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding 阅读全文
posted @ 2019-05-10 16:18 十三w~w 阅读(271) 评论(0) 推荐(0)
摘要:1101 Quick Sort (25 分) There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one elemen 阅读全文
posted @ 2019-05-10 16:17 十三w~w 阅读(177) 评论(0) 推荐(0)