mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-09 03:59:38 +08:00
@ -16,11 +16,11 @@ public class Fibonacci {
|
|||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
int n = Integer.parseInt(br.readLine());
|
int size = Integer.parseInt(br.readLine());
|
||||||
|
|
||||||
// Methods all returning [0, 1, 1, 2, 3, 5, ...] for n = [0, 1, 2, 3, 4, 5, ...]
|
// Methods all returning [0, 1, 1, 2, 3, 5, ...] for n = [0, 1, 2, 3, 4, 5, ...]
|
||||||
System.out.println(fibMemo(n));
|
System.out.println(fibMemo(size));
|
||||||
System.out.println(fibBotUp(n));
|
System.out.println(fibBotUp(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +26,8 @@ public class RodCutting {
|
|||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
int[] arr = new int[]{2, 5, 13, 19, 20};
|
int[] arr = new int[]{2, 5, 13, 19, 20};
|
||||||
int size = arr.length;
|
int size = arr.length;
|
||||||
|
int result = cutRod(arr,size);
|
||||||
System.out.println("Maximum Obtainable Value is " +
|
System.out.println("Maximum Obtainable Value is " +
|
||||||
cutRod(arr, size));
|
result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user