style: format code (#4212)

close #4204
This commit is contained in:
acbin
2023-06-09 18:52:05 +08:00
committed by GitHub
parent ad03086f54
commit 00282efd8b
521 changed files with 5233 additions and 7309 deletions

View File

@@ -17,13 +17,11 @@ public class BinomialCoefficient {
*
* @param totalObjects Total number of objects
* @param numberOfObjects Number of objects to be chosen from total_objects
* @return number of ways in which no_of_objects objects can be chosen from total_objects objects
* @return number of ways in which no_of_objects objects can be chosen from total_objects
* objects
*/
public static int binomialCoefficient(
int totalObjects,
int numberOfObjects
) {
public static int binomialCoefficient(int totalObjects, int numberOfObjects) {
// Base Case
if (numberOfObjects > totalObjects) {
return 0;
@@ -35,9 +33,7 @@ public class BinomialCoefficient {
}
// Recursive Call
return (
binomialCoefficient(totalObjects - 1, numberOfObjects - 1) +
binomialCoefficient(totalObjects - 1, numberOfObjects)
);
return (binomialCoefficient(totalObjects - 1, numberOfObjects - 1)
+ binomialCoefficient(totalObjects - 1, numberOfObjects));
}
}