A TV animator
Title Description
Give you two integer arrays nums1 and nums2 in non decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Please merge nums2 into nums1 so that the merged array is also arranged in non decreasing order.
Title Example
Example 1:
Input: nums1 = [1,2,3,0,0,0], m = ...
Added by jomama on Tue, 25 Jan 2022 17:51:42 +0200
Array chapter of force deduction algorithm training and improvement - punch array Statistics - [645] collection of errors
Basic properties of arrays
Array is the simplest data structure.
Array is used to store a series of data of the same type. Data is stored continuously and memory is allocated at one time.
Insert and delete in the middle of the array. All subsequent data must be moved each time to maintain continuity. The time complexity is O(N).
Array index ...
Added by FunkyELF on Tue, 25 Jan 2022 16:29:27 +0200
Leetcode brush questions must be reviewed II (Leetcode 912 215 315 53)
912. Sort array
Merge
def sortArray(self, nums: List[int]) -> List[int]:
def merge_sort(nums, l, r):
# Termination conditions
if l >= r: return
# Recursive partition array
m = (l + r) // 2
merge_sort(nums, l, m)
merge_sort(nums, m + 1, r)
# ...
Added by chrbar on Tue, 25 Jan 2022 12:51:13 +0200
GO: basic data type - slice
1, Limitations of arrays
Because the length of the array is fixed and the length of the array is part of the type, the array has many limitations. For example:
func arraySum(x [3]int) int{
sum := 0
for _, v := range x{
sum = sum + v
}
return sum
}
This summation function can only accept [3]int type, and others are ...
Added by pablodelapena on Tue, 25 Jan 2022 09:26:25 +0200
[LeetCode algorithm note Python(PyCharm running)] sword finger Offer 24 Reverse linked list
Write in front
Xiaobian found it difficult to understand the detailed process of recursion when brushing questions. His head is like a ball of paste, always with big question marks? We didn't understand the detailed logic until we debugged with PyCharm, so a detailed PyCharm running program is attached for debugging and understanding.
Tit ...
Added by pneudralics on Tue, 25 Jan 2022 03:25:57 +0200
LeetCode 1716. Calculation force deducted from the bank / 382 Random node of linked list (reservoir sampling) / 1220 Count the number of vowel sequences (dynamic gauge, matrix fast power)
1716. The calculation force deducts money from the bank
One question per day on January 15, 2022
Title Description
Hercy wants to save money for her first car. He deposits money in the Likou bank every day.
At first, he deposited 1 yuan on Monday. From Tuesday to Sunday, he deposited 1 yuan more every day than the previous day. In the follo ...
Added by qadeer_ahmad on Mon, 24 Jan 2022 07:04:13 +0200
[sword finger Offer 39. Numbers that appear more than half in the array]
Title Description:
Source: LeetCode Link: https://leetcode-cn.com/problems/shu-zu-zhong-chu-xian-ci-shu-chao-guo-yi-ban-de-shu-zi-lcof/
A number in the array appears more than half the length of the array. Please find out this number.You can assume that the array is non empty and that there are always many elements in a given array. ...
Added by nashyboy on Mon, 24 Jan 2022 02:25:33 +0200
Winter camp: Mathematics
A - A^B Mod C
Give three positive integers a, B, C and find A^B Mod C.
For example, 3 5 8, 3^5 Mod 8 = 3.
Input
Three positive integers a, B, C, separated by spaces. (1 <= A,B,C <= 10^9)
Output
Output calculation results
Sample Input
3 5 8
Sample Output
3
#include<stdio.h>
#include<math.h>
int main ()
...
Added by iriedodge on Sun, 23 Jan 2022 05:59:28 +0200
Linked list data structure of Leetcode problem solution
Leetcode solution - linked list
Leetcode solution - linked list
1. Find the intersection of two linked lists2. Linked list inversion3. Merge two ordered linked lists4. Delete duplicate nodes from the ordered linked list5. Delete the penultimate node of the linked list6. Exchange adjacent nodes in the linked list7. List summation8. Palindr ...
Added by gacon on Sat, 22 Jan 2022 20:16:20 +0200
Leetcode question brushing - Summary of one question per day
Catalogue of series articles
Find traversal
169. Most elements
subject Given an array of size n, find most of its elements. Most elements refer to elements that appear more than ⌊ n/2 ⌋ in the array.
You can assume that the array is non empty and that there are always many elements in a given array.
Example 1:
In ...
Added by keane7 on Sat, 22 Jan 2022 13:32:43 +0200