Tag：leetcode

Time：20191210
Subject requirements Given an array which consists of nonnegative integers and an integer m, you can split the array into m nonempty continuous subarrays. Write an algorithm to minimize the largest sum among these m subarrays. Note: If n is the length of array, assume the following constraints are satisfied: 1 ≤ n ≤ 1000 […]

Time：2019129
D65 892. Surface Area of 3D Shapes Title Link 892. Surface Area of 3D Shapes Title Analysis Given a threedimensional array, returns the surface area of the stroke cylinder. thinking In a 3D array,$arr[$i][$j]The value of represents the height of the cylinder at that point. Therefore, for each value, 6 copies (1 * 1 * […]

Time：2019128
Easy 021 Merge Two Sorted Lists Description： 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.Input: 1>2>4, 1>3>4Output: 1>1>2>3>4>4 My Solution: In order to reduce the space complexity, the final result is directly modified on LIST1 […]

Time：2019127
Subject requirements You have a total of n coins that you want to form in a staircase shape, where every kth row must have exactly k coins. Given n, find the total number of full staircase rows that can be formed. n is a nonnegative integer and fits within the range of a 32bit signed […]

Time：2019126
D66 896. Monotonic Array Title Link 896. Monotonic Array Title Analysis Given an array of numbers, determine whether to monotonically increase or decrease. Monotonically increasing means that for the nth digit, the array after it is greater than or equal to it.Monotonic decrement means that the array after it is smaller than it. thinking First, […]

Time：2019125
subject Given an array of unsorted integers, find the length of the longest consecutive sequence. The time complexity of the algorithm is required to beO(n)。 Example: Input: [100, 4, 200, 1, 3, 2] Output: 4 Explanation: the longest continuous sequence is [1, 2, 3, 4]. Its length is 4. Title Solution At the beginning of […]

Time：2019125
Preface The first unique email address of weekly contest 108: Each email consists of a local name and a domain name [email protected] separation. For example, [email protected],aliceIs the local name, andleetcode.comIt’s a domain name. In addition to lowercase letters, these emails may also contain’,’or’+’。 If theLocal nameAdd a period between some characters in the section（’.’）, the […]

Time：2019124
Given an array nums of n integers, are there elements a, b, c in numssuch that a + b + c = 0? Find all unique triplets in the array whichgives the sum of zero. Note: The solution set must not contain duplicate triplets. Example: Given array nums = [1, 0, 1, 2, 1, 4], […]

Time：2019123
Subject requirements Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST. Basically, the deletion can be divided into two stages: Search for a node to remove. If the node is found, delete the […]

Time：2019122
D67 485. Max Consecutive Ones Title Link 485. Max Consecutive Ones Title Analysis Given a binary array (an array containing only 0 and 1), the longest 1 string is returned. thinking Traverse one by one, and count if it is 1. If 0 is encountered, judge whether the current count is greater than the maximum […]

Time：2019122
Given an array nums of n integers and an integer target, find threeintegers in nums such that the sum is closest to target. Return thesum of the three integers. You may assume that each input would haveexactly one solution. Example: Given array nums = [1, 2, 1, 4], and target = 1. The sum that […]

Time：20191130
D68 283. Move Zeroes Title Link 283. Move Zeroes Title Analysis Given an array of integers, move elements with a value of 0 to the end of the array without changing the order in which other elements appear. thinking Calculate how many elements there are in total. Then fill 0 to the calculated array length […]