The $\texttt{lower_bound}$ function finds the first position where a value could be inserted in without breaking sorter order. Its time complexity is $\texttt{O(log n)}$. For example: $\texttt{it}$ refers to the address of the value. $\texttt{*it}$ refers to the value, and to get the index, use $\texttt{it-v.begin()}$.
Month: May 2026
Lemma Inequality For The Sum of Cubes of Two Terms
Lemma. If $a, b \geq 0$, then $a^3 +b^3 \geq a^2 b + a b ^ 2$. Proof. Since $a,b\geq 0$, $a+b\geq 0$. Also, by the trivial inequality, $(a-b)^2 \geq 0$. Thus, $(a-b)^2 (a+b)\geq 0$. Expanding, $a^3 + b^3 – a^2 b – a b^2 \geq 0$. So, $a^3 +…
