import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a, int n) { // Return the length of the longest possible sequence of moves. long result = 0; for(int i=0; i arr = new ArrayList(); for(long j=1;j<=a[i];j++){ if (a[i]%j==0){ arr.add(j); } } Long paths[] = new Long[arr.size()]; arr.toArray(paths); for(int x=0; x