Skip to content

Commit 5e92f28

Browse files
committed
formatted using LLVM clang-formatter
1 parent 5c447f8 commit 5e92f28

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/com/thealgorithms/dynamicprogramming/MaximumSumOfNonAdjacentElements.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
* https://takeuforward.org/data-structure/maximum-sum-of-non-adjacent-elements-dp-5/
88
*/
99
final class MaximumSumOfNonAdjacentElements {
10-
private MaximumSumOfNonAdjacentElements() {}
10+
private
11+
MaximumSumOfNonAdjacentElements() {}
1112

1213
/**
1314
* Approach 1: Uses a dynamic programming array to store the maximum sum at
@@ -16,7 +17,8 @@ private MaximumSumOfNonAdjacentElements() {}
1617
* @param arr The input array of integers.
1718
* @return The maximum sum of non-adjacent elements.
1819
*/
19-
public static int getMaxSumApproach1(int[] arr) {
20+
public
21+
static int getMaxSumApproach1(int[] arr) {
2022
int n = arr.length;
2123
int[] dp = new int[n];
2224

@@ -51,7 +53,8 @@ public static int getMaxSumApproach1(int[] arr) {
5153
* @param arr The input array of integers.
5254
* @return The maximum sum of non-adjacent elements.
5355
*/
54-
public static int getMaxSumApproach2(int[] arr) {
56+
public
57+
static int getMaxSumApproach2(int[] arr) {
5558
int n = arr.length;
5659

5760
// Two variables to keep track of previous two results:
@@ -82,4 +85,4 @@ public static int getMaxSumApproach2(int[] arr) {
8285

8386
return prev1;
8487
}
85-
}
88+
}

0 commit comments

Comments
 (0)