Application of C++ prefix sum algorithm: Maximizing the minimum number of power supply stations in the city

Basic knowledge points involved in this article C++ algorithm: principles, source code and test cases of prefix sum, prefix product, prefix XOR including course videos dichotomy Title Give you an integer array stations with subscripts starting from 0 and length n, where stations[i] represents the number of power supply stations in the i-th city. Each […]

[Algorithm Challenge] The maximum number of blocks that can be sorted II (including analysis and source code)

768. Maximum number of blocks that can be sorted II https://leetcode-cn.com/problems/max-chunks-to-make-sorted-ii/ 768. Maximum number of blocks that can be sorted II Question description Method 1: Sliding window Ideas Complexity analysis Code (JS/C++) Method 2: Monotone Stack Ideas Illustration Complexity analysis Code (JS/C++) Title description This question is similar to “The maximum number of blocks that […]

[AGC034D] Manhattan Max Matching

Problem Statement Snuke is playing with red and blue balls, placing them on a two-dimensional plane. First, he performed $N$ operations to place red balls. In the $i$-th of these operations, he placed $RC_i$ red balls at coordinates $(RX_i,RY_i)$. Then, he performed another $N$ operations to place blue balls. In the $i$-th of these operations, […]

word2vec improved hierarchical softmax

Table of Contents summary overall process 1.Construct Huffman tree 2. Combine CBOW and Huffman trees 3. Build word2vec model (CBOW) summary Complete code Summary This blog mainly describes in detail the specific process and code implementation of word2vec using hierarchical softmax (hierarchical softmax). For the basic implementation of word2vec, you can read my previous blog: […]