LeetCode Array Easy169. Majority Element

 Description   Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element always exist in the array. Example 1: Input: [3,2,3] Output: 3 Example 2: Input: [2,2,1,1,1,2,2] Output: 2  Problem Description: given a non empty array, find the most frequent element exceeding N/2 times. Idea: The simplest and crudest way to traverse the array, the number of occurrences of each element and elements as a key-value pair to save the form, and finally t...

SQL optimization

SQLoptimization   In order to improve the query efficiency in SQL query, we often take some measures to optimize the query statement sql, the following summary of some methods, there is a need for reference. 1.To optimize queries, avoid full table scanning as much as possible, and consider indexing the columns involved in where and order by first. 2.You should try to avoid null value judgments on fields in the where clause, otherwise it will cause the engine to abandon the use of indexes for full table scanning, such as:   select id from t where num is null   You can set a defaul...

Using Python -m SimpleHTTPServer to quickly build HTTP services

Summary: On Linux servers or Python-installed machines, you can use nohup python-m SimpleHTTP Server [port] amp; quickly build an HTTP service. Python comes with a Web server, SimpleHTTP Server, on a Linux server or on a machine with Python installed. We can easily use python-m SimpleHTTP Server to quickly build an HTTP service that provides a web service for browsing files. WindowsSystem operation is as follows step1:Open the CMD command window Enter the path of the project step2:Start service The order is as follows: python -m SimpleHTTPServer 8000 Using the above command, you can pub...

Summary of FPGA written examination of 2019 schools in Dajiang

1.For synchronous fifo, 80 data can be written per 100 cycles, 8 data can be read per 10 cycles, and the depth of FIFO is at least? 2.If you only use 2 selected 1MUX to complete XOR logic, how many MUX do you need at least? The answer to the question at the beginning is as follows: there are 3 needs to be verified. Later, it was found that the correction was not very correct. At least two needed to be corrected.   3.What is the function of anti-aliasing filter before signal sampling? What kind of filter does it choose? How to determine its cut-off frequency? According to Nyquist Sampli...

Detailed explanation of Xftp5 software

First, run Xftp5 first, then there is a small plus sign on the navigation bar, click in. Second, the following interface appears, fill in the name here (this optional), the host to fill in the IP address of the host to connect, and then the protocol, Linux system generally choose SFTP protocol, port default can. Three, then enter the host account password.Note that you can’t log in here with the root account (that is, the super administrator account), otherwise the “SSH server rejected the password. Please try again.   Four, click OK. This allows the transfer of files between ...

Nginx common mistakes

error message Error description “upstream prematurely(Premature “closed connection” The exception that occurs when requesting URI is due to the disconnection of the user before upstream returns the response to the user. It has no effect on the system and can be ignored “recv() failed (104: Connection reset by peer)” (1)The number of concurrent connections of the server exceeds its carrying capacity, and the server will drop some of its connections to Down. (2)The client turned off the browser while the server was sending the dat...

PIP bulk updates of installed packages

——————pipBatch update library 1)View expired Library pip list --outdated  Updating a single library: pip install --upgrade The name of the library Batch upgrade update all expired Libraries import pipfrom pip._internal.utils.misc import get_installed_distributionsfrom subprocess import callfor dist in get_installed_distributions():    call("pip install --upgrade " + dist.project_name, shell=True) AnacondaBatch update library  Update all libraries conda update -all Update Anaconda conda update conda

Database – something you might overlook.

databases. You may have overlooked them. https://www.cnblogs.com/joylee/p/7768457.html Database management is a very professional thing, the database tuning, monitoring is usually done by database engineers, but developers also often deal with the database, even a simple addition, deletion, modification and investigation is also a lot of tricks, here, to talk about the database is easy to overlook the problem. The length of the field is saved. First, let’s talk about the storage length of our commonly used types: Column type storage length tinyint 1byte smallint 2byte int 4byte bigint ...