Reprint blog: https://cloud.tencent.com/developer/article/1408608
Question A: form A team
Total score of this question: 5 points As a basketball team coach, you need to choose one player from position 1 to position 5 from the following list, Form the team's starting lineup. The score of each player from position 1 to position 5 is shown i ...
Posted by ksas025 on Tue, 08 Mar 2022 05:06:16 +0100
A friend suddenly asked me a question about the probability of winning in a row. I'll study it myself, share it with you and record it at the same time.
Xiao Ming plays 10 sets of King glory every day, and the winning and losing are completely random (the winning rate is 50%). Please write a simulation algorithm wit ...
Posted by shaoen01 on Tue, 08 Mar 2022 03:04:47 +0100
9.1 hash table (hash) - Google questions
Let's take a look at the actual demand. A computer problem of google: In one company, when a new employee comes to report, it is required to add the employee's information (id, gender, age, address...). When entering the employee's id, it is required to check
Find all the information of the empl ...
Posted by rtconner on Mon, 07 Mar 2022 22:49:58 +0100
Regular Expression Matching Give you a string s and a character rule p, please implement a support '.' Matches the regular expression of '*'.
‘.’ Match any single character '*' matches zero or more preceding elements The so-called matching is to cover the whole string s, not part of the string.
Input: s = &q ...
Posted by Robert Plank on Mon, 07 Mar 2022 19:20:41 +0100
3. Common sorting algorithms
learning objective: master common sorting algorithms.
introduction to algorithm:
Sort / / sort the elements in the containerrandom_shuffle / / shuffle and randomly adjust the order of elements within the specified rangeMerge / / merge container elements and store them ...
Posted by admin on Mon, 07 Mar 2022 18:24:47 +0100
Ant colony algorithm for TSP problem
Introduction to TSP issues
Traveling businessmen need to visit n cities and finally return to the starting city. They are required to visit each city only once. The optimization goal is to minimize the sum of distances.
Example solution results
20 city coordinates: (88, 16), (42, 76), (5, 76), (69, 13), ...
Posted by daredevil88 on Mon, 07 Mar 2022 15:45:01 +0100
1.MATLAB program implementation
The code is as follows:
%% Clear environment variables
%% Initialization parameters
data = rand(400, 2);
plot(data(:, 1), data(:, 2), 'ro', 'MarkerSize', 8);
xlabel 'Abscissa X'; ylabel 'Ordinate';
title 'sample data ';
K = 4; % Number of classifications
Posted by Hamish on Mon, 07 Mar 2022 15:38:16 +0100
Hey, c + + long time no see, meet you again familiar and strange. The feeling of practicing many brush questions fades a little, and you need to be familiar with the actual questions again. This article will be continuously updated Today, let's remedy the concept of STL in time to facilitate more efficient problem brushing in the future.
Posted by vombomin on Mon, 07 Mar 2022 15:09:08 +0100
Cut the grid of previous test questions Time limit: 1.0s memory limit: 256.0MB
Problem description As shown in the figure below, some integers are filled in the 3 x 3 grid.
±-*–±-+ |10* 1|52| ±- ****–+ |20|30 * 1| ********–+ | 1| 2| 3| ±-±-±-+
We cut along the asterisk line in the figure to get two parts. The sum of the n ...
Posted by littlegiant on Mon, 07 Mar 2022 14:11:55 +0100
Cut down unnecessary subtrees on the search tree through some judgment. Sometimes, we will find that the subtree state corresponding to a node is not the result we want, so we don't need to search this branch. Cutting off this subtree is pruning.
Once the final solution of some states can not be found in any case, it can ...
Posted by Phasma Felis on Mon, 07 Mar 2022 10:52:25 +0100