天道酬勤,学无止境

博客

Programmer Interview Golden Classic-Interview Questions 17.25. Word Matrix (Trie tree + DFS backtracking, hard)

1. Title Given a list of words, design an algorithm to create the largest rectangle of letters, where each row forms a word (from left to right), and each column also forms a word (from top to bottom). These words are not required to appear consecutively in the list, but all rows are required to be the same length and all columns are the same height. If there are multiple rectangles with the largest area , any one of them can be output. A word can be used repeatedly. 示例 1: 输入: ["this", "real", "hard", "trh", "hea", "iar", "sld"] 输出: [ "this", "real", "hard" ] 示例 2: 输入: ["aa"] 输出: ["aa","aa"]

2021-06-13 06:56:07   

[Interview Question] It is known that the f() function outputs 1 with probability p and 0 with probability 1-P. It is required to realize the output 1 and 0 with equal probability of g()

Ideas Call the RANDOM function twice, if its probability is P(x), call it twice P(1) = p P(0) = 1-p P'(1) =p P'(0) = 1-p The probabilities are as follows: 11 p*p 10 p*(1-p) 01 (1-p)*p 00 (1-p)*(1-p) Code: int Rand() { int i1 = rand(); int i2 = rand(); if(i1==0 && i2==1) return 1; else if(i1==1 && i2==0) return 0; else return Rand(); return -1; } Expand Generate random numbers between [1, n] with equal probability. First, calculate the number of bits k that the binary representation of the integer n has, k = 1 + log2n (log base 2 is n). Then call Rand() k times to generate random numbers. Code

2021-06-13 06:56:02   

windows kill process

windows kill process windows+rcmdnetstat -ano|findstr 8080taskkill /F /PID 9800 Origin:https://blog.csdn.net/dongxiaomingdxm/article/details/105568279

2021-06-13 06:55:59   

Solve the problem of copying and dragging between Virtualbox and the local host

Everyone who has used Virtualbox knows that if Virtualbox and the local host cannot copy, paste and other functions, it is quite inconvenient to use. Let me share my method to solve the problem of copying and dragging Virtualbox and the local host. First of all, in Most of the tutorials on the Internet are Click on the device ----- sharing pasteboard ---- drag and drop are set to two-way, and then click to install enhanced features, I have done these steps according to the online tutorials, but Virtualbox and the local host can not be achieved Copy and paste each other, I don’t know if any

2021-06-13 06:55:55   

[剑指 offer]--String--Interview Question 58-II. Rotate the string to the left

1 topic description The left rotation operation of the string is to transfer several characters in front of the string to the end of the string. Please define a function to realize the left rotation operation of the string. For example, if you enter the string "abcdefg" and the number 2, the function will return the result "cdefgab", which is rotated two bits to the left. Example 1: Input: s = "abcdefg", k = 2 Output: "cdefgab" Example 2: Input: s = "lrloseumgh", k = 6 Output: "umghlrlose" limit: 1 <= k < s.length <= 10000 Source: LeetCode Link: https://leetcode-cn.com/problems/zuo-xuan-zhuan

2021-06-13 06:55:51   

Running vs prompts that the system resources are insufficient and the requested service cannot be completed

VS running code prompts that the system resources are insufficient and the requested service cannot be completedOperating environmentproblemSolution Operating environment win10+visual studio2019 problem I ran a code that ran last week without any problems, and suddenly prompted "The system resources are insufficient to complete the requested service." I thought it was because there were too many background applications, and there were still prompts after closing. Reluctant to restart, there are still prompts after restarting and still cannot run the program. Solution Turn off the real-time

2021-06-13 06:55:42   

Win10 operating system install MySql-8.0.12.zip

1. Operating system Win10 2.MySql version: 8.0.12 3. MySql official website: https://dev.mysql.com/downloads/mysql/ 4. Get information from Baidu Netdisk: Link: https://pan.baidu.com/s/1WAlxllujdOIcm8_BuRMbSw Extraction code: kc4e Download mysql-8.0.12-winx64 as shown below: 5. Write your own my.ini file, the content is as follows [mysqld] # Set 3306 port port=3306 # Set mysql installation directory basedir=E:/programs/database/mysql/mysql-8.0.12-winx64 # Set the storage directory of the mysql database data datadir=E:/programs/database/mysql_data # Allow the maximum number of connections max

2021-06-13 06:55:40   

Linux study notes--Niaoge's Linux private kitchen (full)

What to do if there is a problem Linux own file data: /usr/share/doc The Linux Documentation Project: http://www.tldp.org/ linux.vbird.org/Searching.php /var/log log file Cool School Forum phorum.study-area.org Bird brother's private kitchen discussion area phorum.vbird.org Linux distributions are divided into two major families One is the system for installing software in RPM, including Red Hat, Fedora, etc., and the other is the system for installing software in dpkg. File name of each hardware device in Linux In the Linux system, each device is treated as a file.Almost all hardware device

2021-06-13 06:55:36   

Zuoshen algorithm advanced class2—monotonic stack application: the maximum area of ​​the rectangle in the histogram

Zuoshen algorithm advanced class2—monotonic stack application: the maximum area of ​​the rectangle in the histogram 1. Title: Maximum area of ​​rectangle in histogram 2. Analysis 3. Core code 4. Complete code 1. Title: Maximum area of ​​rectangle in histogram Given the array {6,5,2,3,4} represents the height of the histogram, find the maximum area of ​​the rectangle, as shown in the figure below, the maximum area is 10 in red or blue 2. Analysis In this question, the height of the histogram can be regarded as a pole, and the maximum distance the pole traverses is the largest area. As shown in

2021-06-13 06:55:26   

Get Java in 30 days--day28

Article DirectoryDaily exam and review Java reflection mechanism Overview of Java reflection mechanismUnderstand the Class class and get the Class instanceClass loading and the understanding of ClassLoaderCreate objects of runtime classGet the complete structure of the runtime classGet the attribute structure of the current runtime classGet the method structure of the runtime classGet other structuresCall the specified structure of the runtime class Daily exam and review Take a test every day An IP corresponds to an object of which class? What are the two ways to instantiate this class? What

2021-06-13 06:55:21