[LeetCode] 0371. sum of two integers
Given two integers a and b, return the sum of the two integers without using the operators + and -.
[LeetCode] 0371. sum of two integers Read More »
Leetcode, Technical ArticleGiven two integers a and b, return the sum of the two integers without using the operators + and -.
[LeetCode] 0371. sum of two integers Read More »
Leetcode, Technical ArticleGiven an integer array nums, find a subarray that has the largest product, and return the product.
The test cases are generated so that the answer will fit in a 32-bitinteger.
[LeetCode] 0152. Maximum Product Subarray Read More »
Leetcode, Technical ArticleYou are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).
Find two lines that together with the x-axis form a container, such that the container contains the most water.
Return the maximum amount of water a container can store.
Notice that you may not slant the container.
[LeetCode] 0011. Container With Most Water Read More »
Leetcode, Technical ArticleGiven an array of n integers nums and an integer target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + nums[j] + nums[k] < target.
[LeetCode] 0259. 3Sum Smaller Read More »
Leetcode, Technical ArticleVisitor background introduction:
1. Wiwynn: Server Verification Engineer Machine
2. Academic background: Graduate School of the Four Major Management Schools
3. Job content: Conduct quality verification and debugging of server services designed by the R&D unit to ensure that the products meet customer needs and specifications, and maintain stability and correctness in actual operations.
[Engineer Interview] Hardware server verification engineer experience sharing Read More »
Technical ArticleGiven an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.
Return the sum of the three integers.
You may assume that each input would have exactly one solution.
[LeetCode] 0016. 3Sum Closest Read More »
Leetcode, Technical ArticleGiven an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets
[LeetCode] 0015. 3Sum Read More »
Leetcode, Technical ArticleThere is an integer array nums sorted in ascending order (with distinct values).
Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= 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 possible rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums. You must write an algorithm with O(log n) runtime complexity.
[LeetCode] 0033. Search in Rotated Sorted Array Read More »
Leetcode, Technical ArticleSuppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:
[4,5,6,7,0,1,2] if it was rotated 4 times.
[0,1,2,4,5,6,7] if it was rotated 7 times.
Notice that rotating an array [a[0], a[1], a[2], …, a[n-1]] 1 time results in the array [a[n-1], a[0], a [1], a[2], …, a[n-2]].
Given the sorted rotated array nums of unique elements, return the minimum element of this array.
You must write an algorithm that runs in O(log n) time.
[LeetCode] 0153. find minimum in rotated sorted array Read More »
Leetcode, Technical ArticleGiven an integer array nums, find the subarray with the largest sum, and return its sum.
[LeetCode] 0053. Maximum Subarray Read More »
Leetcode, Technical Article