mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-29 15:34:21 +08:00
Format code with prettier (#3375)
This commit is contained in:
@ -38,10 +38,8 @@ public class LongestAlternatingSubsequence {
|
||||
|
||||
/* Compute values in bottom up manner */
|
||||
for (int i = 1; i < n; i++) {
|
||||
|
||||
/* Consider all elements as previous of arr[i]*/
|
||||
for (int j = 0; j < i; j++) {
|
||||
|
||||
/* If arr[i] is greater, then check with las[j][1] */
|
||||
if (arr[j] < arr[i] && las[i][0] < las[j][1] + 1) {
|
||||
las[i][0] = las[j][1] + 1;
|
||||
@ -63,8 +61,12 @@ public class LongestAlternatingSubsequence {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int arr[] = {10, 22, 9, 33, 49, 50, 31, 60};
|
||||
int arr[] = { 10, 22, 9, 33, 49, 50, 31, 60 };
|
||||
int n = arr.length;
|
||||
System.out.println("Length of Longest " + "alternating subsequence is " + AlternatingLength(arr, n));
|
||||
System.out.println(
|
||||
"Length of Longest " +
|
||||
"alternating subsequence is " +
|
||||
AlternatingLength(arr, n)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user