tony
Cool Learning Tool for Programming
Category: /Programming/
(1280 views)0
https://www.algoexpert.io
/questions/Validate Subsequence
import java.util.*;
class Program {
public static boolean isValidSubsequence(List
// Write your code here.
int currentPosition = 0;
for (Integer element : sequence) {
if(array.indexOf(element) < currentPosition){
return false;
}
else{
currentPosition = array.indexOf(element);
array = array.subList(currentPosition+1, array.size());
currentPosition = 0;
}
}
return true;
}
}
Favorite Favorite Comment Comment Share Share
Report an item by sharing it with support.
© individual authors and creators. Create, Share and Profit at etastic.com.