偶然聽到這首歌,跟介紹過的每首都有感動的感覺,決定好好研究一下,下週我生日會停刊一週,也先祝Shvara生日快樂。
Documents
Documents tell us before we write documents, we must state our purpose. Who should read those documents, don’t waste the reader’s time.
Punctuation tells us that we need to choose the right sign. if two sentences have a connection, we should use semicolons; if the connection is a sequence, we should use commas; if the second sentence is used to emphasize the first sentence - em-dashes; if the second sentence is minor points (parentheses).
33. Search in Rotated Sorted Array
There is an integer array nums sorted in ascending order (with distinct values).
Prior to being passed to your function, nums is rotated at an unknown pivot index k (0 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], …, nums[n-1], nums[0], nums[1], …, nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].
Given the array nums after the rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums.
Example 1:
1 | Input: nums = [4,5,6,7,0,1,2], target = 0 |
Example 2:
1 | Input: nums = [4,5,6,7,0,1,2], target = 3 |
Example 3:
1 | Input: nums = [1], target = 0 |
23. Merge k Sorted Lists
You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.
Merge all the linked-lists into one sorted linked-list and return it.
Example 1:
1 | Input: lists = [[1,4,5],[1,3,4],[2,6]] |
Example 2:
1 | Input: lists = [] |
21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the first two lists.
Example 1:
1 | Input: l1 = [1,2,4], l2 = [1,3,4] |
Example 2:
1 | Input: l1 = [], l2 = [] |
Example 3:
1 | Input: l1 = [], l2 = [0] |