Format code with prettier (#3375)

This commit is contained in:
acbin
2022-10-03 17:23:00 +08:00
committed by GitHub
parent 32b9b11ed5
commit e96f567bfc
464 changed files with 11483 additions and 6189 deletions

View File

@ -22,11 +22,10 @@ public class CatalanNumber {
* @return catalanArray[n] the nth Catalan number
*/
static long findNthCatalan(int n) {
// Array to store the results of subproblems i.e Catalan numbers from [1...n-1]
long catalanArray[] = new long[n + 1];
// Initialising C₀ = 1 and C₁ = 1
// Initialising C₀ = 1 and C₁ = 1
catalanArray[0] = 1;
catalanArray[1] = 1;
@ -48,7 +47,9 @@ public class CatalanNumber {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number n to find nth Catalan number (n <= 50)");
System.out.println(
"Enter the number n to find nth Catalan number (n <= 50)"
);
int n = sc.nextInt();
System.out.println(n + "th Catalan number is " + findNthCatalan(n));