H-Index in Java | Linear Bucket Solution | LeetCode 274 | Prepflix
Learn threshold predicates, sorting intuition, clamped buckets, suffix counts, invariants and inclusive boundaries. Includes Java coding, proof, dry runs and genuine submissions.
Baseline: Accepted 83/83, 19 ms, 43.42 MB. Linear Bucket Solution: Accepted 83/83, 0 ms, 43.25 MB. Measurements vary.
Practice:
Baseline:
Optimized:
CHAPTERS
00:00 H-Index: a threshold supported by enough papers
00:34 Read the definition as a yes-or-no test
01:06 Example: why three is the maximum
01:40 Bound the answer and use monotonicity
02:18 Baseline: recount papers for each threshold
02:52 Baseline Java: implement the predicate
03:26 Baseline completion and cost
03:59 Genuine baseline submission
04:33 Sorting provides an intermediate viewpoint
05:08 Compress all large citations into bucket n
05:45 Build the histogram in one pass
06:23 Suffix counts reuse earlier work
07:02 Optimal Java: allocate and populate buckets
07:34 Optimal Java: accumulate and return
08:10 Dry run the suffix scan
08:40 Prove the counting invariant
09:17 Prove feasibility and maximality
09:55 Edge cases and inclusive boundaries
10:33 Complexity and the space tradeoff
11:10 Genuine optimized result
11:45 Test against the definition, not another histogram
12:21 Recap: turn repeated predicates into shared counts
#Java #LeetCode #Sorting #Prepflix
source
