Repository navigation
Conversation
Bhumit267
requested review from
DenizAltunkapan,
alxkm and
yanglbme
as code owners
November 6, 2026 20:16
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7732 +/- ##
============================================
- Coverage 82.28% 82.27% -0.02%
+ Complexity 8414 8412 -2
============================================
Files 843 843
Lines 26150 26150
Branches 5104 5105 +1
============================================
- Hits 21518 21515 -3
Misses 3842 3842
- Partials 790 793 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clang-format -i --style=file path/to/your/file.javaDescription
In$n$ -th Catalan number using the factorial formula:
$$\frac{(2n)!}{(n+1)! \cdot n!}$$
CatalanNumbers.java,catalan(n)computes thePreviously,$21!$ and higher overflow 64-bit $\approx 2.43 \times 10^{18}$ and $\approx 9.22 \times 10^{18}$ ), computing $(2n)!$ for any $n \ge 11$ ($2n \ge 22$ ) caused silent integer overflow, resulting in incorrect and negative results (e.g.
factorial(int n)used standard 64-bit signedlongarithmetic. Becauselong(where20!isLong.MAX_VALUEiscatalan(11)evaluated to-65instead of58786).Changes
factorial(int n)to useBigIntegerinternally to prevent intermediate integer overflow during multiplication.public static long catalan(final int n)unchanged.IllegalArgumentException) becauselong(CatalanNumbersTest.javawith test cases forVerification
mvn test -Dtest=CatalanNumbersTestpasses (15/15 tests passing).mvn checkstyle:checkpasses with 0 violations.