[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "combined sum III"
1, Title Requirements
Find all combinations of k numbers whose sum is n. only positive integers of 1 - 9 are allowed in the combination, and there are no duplicate numbers in each combination.explain:
All numbers are positive integers.
The solution set cannot contain duplicate combinations. Example 1:
input: k = 3, n = 7
output: [[1,2 ...
Posted by phonydream on Mon, 10 Jan 2022 11:39:37 +0100
Leetcode---2. Add two numbers (linked list)
Give you two non empty linked lists to represent two non negative integers. They store each number in reverse order, and each node can store only one number.
Please add the two numbers and return a linked list representing sum in the same form.
You can assume that neither number starts with 0 except the number 0. Input: l1 = [2,4,3], l2 = [5, ...
Posted by st3ady on Mon, 10 Jan 2022 06:32:50 +0100
Sword finger Offer 35 Replication of complex linked list (java implementation, in-situ modification solution)
Let's start with:
Please implement the copyRandomList function to copy a complex linked list. In a complex linked list, each node has a next pointer to the next node and a random pointer to any node or null in the linked list.
Example 1:
Input: head = [[7, null], [13, 0], [11, 4], [10, 2], [1, 0]] Output: [7, null], [13, 0], [11, 4 ...
Posted by numtre on Sun, 09 Jan 2022 23:07:07 +0100
Data structure -- sequential table (array) topic
Array of related interview questions
Click to enter > > Remove element (LeetCode)
Give you an array num and a value val. you need to remove all elements with a value equal to Val in place and return the new length of the removed array. Instead of using extra array space, you must use only O(1) extra space and modify the input arr ...
Posted by Valord on Sun, 09 Jan 2022 15:10:09 +0100
Summary of problem solutions for single week competition on January 9, 2022
T1 5976. Check whether each row and column contain all integers
For a matrix of size n x n, if each row and column contains all integers from 1 to n (including 1 and N), the matrix is considered to be an effective matrix.
Give you an integer matrix of size n x n, please judge whether the matrix is a valid matrix: If yes, return true; Otherwis ...
Posted by fcaserio on Sun, 09 Jan 2022 13:51:20 +0100
Six basic sorting
Six basic sorting
Learning records
I Simple sort
1.1 bubble sorting
It means that two adjacent elements are compared, and the largest element is selected at each time and placed on the last side
package sort;
/**
* Bubble sorting
* It means that two adjacent elements are compared, and the largest element is selected at each time and pla ...
Posted by TRemmie on Sun, 09 Jan 2022 10:59:07 +0100
Fall in love with data structures and algorithms course notes for the third quarter 01
Note: some drawing parameters come from network resources
1._ 88 merge two ordered arrays
Label: merge sort, three pointers
Idea: set three pointers to point to the tail i1 of the actual array, the array i2 and the tail i3 of the overall array.
Compare the values pointed to by i1 and i2 every time. If i2 > i1, exchange the value pointe ...
Posted by HowdeeDoodee on Sun, 09 Jan 2022 10:08:53 +0100
Linked list - find entry ring node
subject
If a linked list contains a ring, the first node entering the ring from the chain header node in the direction of the next pointer is the ring entry node. Now that the head node head is known, locate the entry node. Idea:
Differential method - make n turns when the fast and slow pointers meet. Adjust the starting posit ...
Posted by Vinze on Sun, 09 Jan 2022 09:54:56 +0100
"Bogey sends you an invitation to learn", a one-way and two-way linked list of data structure
catalogue
order
Hi, this is fox
Single linked list
Node of one-way linked list
Unidirectional linked list experiment
Experiment content:
Experiment Description:
Source code
Operation screenshot:
Bidirectional linked list
Creation of bidirectional linked list
Bidirectional linked list experiment
Experiment content:
Experiment Descr ...
Posted by sonny on Sun, 09 Jan 2022 01:53:30 +0100
Hash table -- Python implementation
Hash table (basic concept)
Hash table (also known as hash table) is a kind of data set, in which the storage mode of data items is especially conducive to fast search and location in the future.
Each storage location of the hash table becomes a slot that can be used to store data items. Each slot has a unique name.
The function that i ...
Posted by vanzkee on Sat, 08 Jan 2022 17:39:26 +0100