Skip to content

Commit 9fdb1c8

Browse files
authored
Merge pull request TheAlgorithms#1027 from salonilakhotia/master
Result print
2 parents f6ca5e3 + f575223 commit 9fdb1c8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

DynamicProgramming/Fibonacci.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public class Fibonacci {
1616
public static void main(String[] args) throws Exception {
1717

1818
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
19-
int n = Integer.parseInt(br.readLine());
19+
int size = Integer.parseInt(br.readLine());
2020

2121
// Methods all returning [0, 1, 1, 2, 3, 5, ...] for n = [0, 1, 2, 3, 4, 5, ...]
22-
System.out.println(fibMemo(n));
23-
System.out.println(fibBotUp(n));
22+
System.out.println(fibMemo(size));
23+
System.out.println(fibBotUp(size));
2424
}
2525

2626
/**

DynamicProgramming/RodCutting.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ private static int cutRod(int[] price, int n) {
2626
public static void main(String args[]) {
2727
int[] arr = new int[]{2, 5, 13, 19, 20};
2828
int size = arr.length;
29+
int result = cutRod(arr,size);
2930
System.out.println("Maximum Obtainable Value is " +
30-
cutRod(arr, size));
31+
result);
3132
}
3233
}

0 commit comments

Comments
 (0)