Popular Posts
- [Finite-Dimensional Linear Algebra] 2.2 Vector Spaces + 2.3 Subspaces The elements of vector space `V` are called vectors, and the elements of the corresponding field `F` are called scalars. Definition of a Vector SpaceLet `F` be a field and let `V` be a nonempty set with two operations defined with respect to these sets: (vector) addition: `u, v \in V \Rightarrow u + v \in V`scalar multiplication: `\alpha \in F, v \in V \Rightarrow \alpha v \in V` `V` is a vecto.. Show More
- [LeetCode] 493. Reverse Pairs ProblemExplanationFor an array `[x_1, \dots , x_n],` suppose `(i, j)` is a reverse pair, meaning `x_i > 2x_j`. If there exist indices `k` and `t` such that ``i ``x_i \leq x_{k} \quad \text{and} \quad x_{t} \leq x_j,``then ``x_{k} \ge x_i > 2x_j \quad \text{and} \quad x_i > 2x_j \ge 2x_{t}.`` From these inequalities, it follows that the pairs `(k, t)` , `(i, t)`, and `(k, j)` must also be reverse.. Show More
- [LeetCode] 2681. Power of Heroes ProblemExplanationThe power of a group of heroes is defined by the square of the maximum strength multiplied by the minimum strength: ``Power = (max)^2 \times min.`` To solve this efficiently, sort the array `[x_0, x_1, \dots , x_{n-1}]` in ascending order. Once sorted, for any subset with minimum index `i` and maximum index `j` `\{x_i , \dots , x_j\}` `(i To calculate the total power, analyze t.. Show More
- [LeetCode] 1590. Make Sum Divisible by p ProblemExplanationWe are given an array `[x_0,x_1,x_2,\dots ,x_{n-1}] ,` and a positive integer `p`. Let `S` represent the total sum of the array and `R` the total remainder, defined as `R = S \bmod p.` Our goal is to remove one contiguous subarray `[x_i,\dots ,x_j]` such that the remaining sum is divisible by `p`: ``(S-(x_i + \cdots + x_j)) \bmod p = 0.``This condition is equivalent to `` (x_i .. Show More