LeetCode 3083 - Existence of a Substring in a String and Its Reverse
This is a Type B, “Prove that” problem. The statement to prove is: Among all triangles determined by 100 points in general position, at most 70% are acute. The proposed proof attempts to establish a universal upper bound on the number of acute triangles.
Difficulty: 🟢 Easy
Topics: Hash Table, String
Solution
Problem-Type Check
This is a Type B, “Prove that” problem.
The statement to prove is:
Among all triangles determined by 100 points in general position, at most 70% are acute.
The proposed proof attempts to establish a universal upper bound on the number of acute triangles. It does not need to characterize equality cases or extremal configurations.
However, the proof does not successfully prove the claimed statement via a valid argument. The key local geometric counting lemma is not correctly justified. Although the final numerical conclusion obtained is even stronger than required, a stronger conclusion derived from an invalid step does not constitute a proof.
Step-by-Step Verification
Step 1: Reduction to counting acute angles at a fixed vertex
Claim: Fix a point $P$. Count pairs $(A_i,A_j)$ such that $\angle A_iPA_j<\frac{\pi}{2}$, then relate them to acute triangles through $P$.
Verdict: VALID
This is a standard and correct reduction. An acute triangle is characterized by all three angles being acute, so counting acute angles at each vertex is appropriate.
Step 2: Geometric characterization via scalar product
Claim: For fixed $A_i$, the condition
$$\angle A_iPX<\frac{\pi}{2}$$
is equivalent to
$$\overrightarrow{PA_i}\cdot \overrightarrow{PX}>0,$$
hence $X$ lies in an open half-plane bounded by the line through $P$ perpendicular to $PA_i$.
Verdict: VALID
This equivalence is correct.
Step 3: Lemma 1, the claim that at most 49 points lie in the relevant semicircle
Claim: For fixed $A_i$, at most $49$ points $A_j$ satisfy
$$\angle A_iPA_j<\frac{\pi}{2}.$$
Verdict: WRONG
Classification: Critical error
This is the central flaw of the proof.
The argument given for the bound $49$ is invalid. The proof says:
“Among the remaining 98 points distinct from $A_i$, at most 49 can lie in this open semicircle.”
But this is false in general.
There is no theorem stating that an arbitrary open semicircle of directions from $P$ can contain at most half the points. In fact, configurations exist where many more than half the points lie in such a semicircle.
For example, take $P$ and place all other $99$ points inside a narrow cone of angle less than $\frac{\pi}{2}$. Then for a suitable choice of $A_i$, almost all remaining points satisfy
$$\angle A_iPA_j<\frac{\pi}{2}.$$
In particular, far more than $49$ such points can occur.
The proof attempts to justify the bound by saying:
“contradicting the fact that an open semicircle determined by a diameter cannot contain more than $\frac{99-1}{2}=49$ further points.”
But no such fact exists. This is simply an unsupported and false assertion.
The argument involving “more than half of the remaining points” is also invalid. A line through $P$ may certainly leave unequal numbers of points on the two sides.
A concrete small counterexample illustrates the failure.
Take $n=5$. Put four points all in a tiny sector around a ray from $P$. Then for one chosen point $A_i$, all other three points satisfy
$$\angle A_iPA_j<\frac{\pi}{2}.$$
But the proposed bound would predict at most
$$\frac{5-1}{2}=2.$$
So the claimed local bound is false already for $n=5$.
Explicitly checking small values:
For $n=3$:
Maximum possible acute neighbors for a fixed $A_i$ is $1$, while the claimed bound gives $(3-1)/2=1$. No contradiction.
For $n=4$:
Maximum possible is $2$, while claimed bound gives $1.5$, effectively $1$. False.
For $n=5$:
Maximum possible is $3$, while claimed bound gives $2$. False.
Thus the key lemma fails even in small cases.
Step 4: Lemma 2, counting acute triangles through $P$
Claim: The number of acute triangles having vertex $P$ is at most
$$\frac{99\cdot 49}{2}.$$
Verdict: UNJUSTIFIED
Classification: Critical error
This step depends entirely on Lemma 1. Since Lemma 1 is false, this counting bound has no foundation.
The ordered-pair to unordered-pair division by $2$ is itself correct, but the numerical bound is unsupported.
Step 5: Global summation over all vertices
Claim:
$$3T\le 100\cdot \frac{99\cdot 49}{2}.$$
Verdict: UNJUSTIFIED
Classification: Justification gap, inherited from previous critical error
The mechanism of counting each acute triangle three times is correct. However, since the per-vertex bound is invalid, the inequality itself is not established.
Step 6: Final numerical conclusion
Claim:
$$T\le \frac12 \binom{100}{3}<\frac{7}{10}\binom{100}{3}.$$
Verdict: UNJUSTIFIED
Classification: Inherited critical failure
The algebra from the previous inequality is correct, but the previous inequality was never validly proved.
Completeness Check
The proof does not successfully establish the key local counting bound. This is not a minor omission or technicality. It is the entire engine driving the argument.
The proof repeatedly assumes a nonexistent property:
No open semicircle through $P$ can contain more than half the remaining points.
That statement is false.
The rest of the proof structure would be logically coherent if such a bound were true, but it is not.
There are no additional missing edge cases beyond this, because the proof already collapses at the central lemma.
Summary
The proof fails because Lemma 1 is false. An open semicircle of directions around a point $P$ can contain far more than half of the other points. Consequently, the bound of $49$ acute neighbors for a fixed ray is invalid, and all subsequent counting arguments collapse.
The single most critical flaw is the unsupported and false assertion that an open semicircle determined by a perpendicular through $P$ can contain at most half of the remaining points.
VERDICT: FAIL - the proof’s central lemma is false, since an open semicircle around a point can contain more than half of the other points.