Origin of Ray

Lift the fog of the Internet together

Yesterday was the Lantern Festival, and leetcode’s daily question also came up with a question to guess the word puzzle.

Since I’m not good at real charades, let’s take a look at this algorithm’s charade.

First, the link to the topic:

https://leetcode-cn.com/problems/number-of-valid-words-for-each-puzzle/

Problem-solving ideas

We can design an algorithm to solve this puzzle problem.

  • First, we calculate the set Sw corresponding to each word and store it in a “data structure” for quick search in subsequent operations;

  • Then we enumerate each puzzle in turn, calculate its corresponding set Sp, and enumerate the subset S’p that meets the requirements. For each S’p, we look up the number of occurrences in the “data structure”, then the sum of the occurrences of all S’ps is the number of puzzles corresponding to the puzzle.

With this solution, we can think about how to design this data structure, so that we can quickly store and search.

Read more »

After using JavaScript for so long, I realized that I have always misunderstood the event loop mechanism of JavaScript.

First, the event loop mechanism is not implemented in V8. The V8 engine is only responsible for compiling JavaScript code, memory allocation, etc.

Second, Chrome event loop mechanism is implemented through the web API, while Node is libuv.

Third, before Node11, the principle of Node’s event loop was different from Chrome.

Read more »

This week’s daily question, do algorithm, have imagination, enough to fully explore the known conditions.

Read more »

Today’s leetcode daily question is a medium difficulty question, but the various ideas of the solution are really innovative, and I will record it here.

Every time I encounter such imaginative solutions, I feel very happy. They just use some methods that you have already mastered, but they can be used very skillfully.

Read more »

File Upload Vulnerabilities and Their Harm

File upload vulnerability refers to a network attacker uploading an executable file to the server and executing it. The uploaded file here can be a Trojan horse, virus, malicious script or WebShell, etc.

Due to insufficient programmer control over the user file upload portion or processing defects, resulting in the user can cross its own authority to upload executable dynamic script files to the server.

Read more »

The global APIs of the Vue2 era are all mounted on the Vue prototype, so any modification to the global API will affect all Vue instances. This may be undesirable, and such modifications are irreversible.

Therefore, in order to cope with this situation, Vue3 will transform the global API and introduce the concept of APP. Each instance is an APP, and the global API acts on the APP.

Read more »

VLAN (Virtual LAN), translated into Chinese as “virtual local area network”. A LAN can be a network composed of a few home computers or an enterprise network composed of hundreds of computers. The LAN referred to by VLAN refers specifically to a network divided by routers - that is, a broadcast domain.

The subnet is also a network divided by routers.

What is the difference between the two? The most essential difference is that, according to the network layering model, ** VLAN is mainly used to divide the broadcast domain of the data link layer, while subnetting is to divide the network layer through IP Address **. If subnetting is done with CIDR, then if the two IP Addresses are calculated through the subnet mask and the result is the same, it is the same subnet.

Read more »

In this blog we continue to look at some of the new features of Vue3, including Teleport, snippets, and trigger component options.

Most of the content comes from the official doc, which explains and summarizes some difficult parts.

Read more »
0%