You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @RodneyShag, I have saved most of all my Hackerank solutions and I would love to contribute them to this repo for the C++ solutions part. So can you let me know what I should do next?
The text was updated successfully, but these errors were encountered:
}
private static boolean isSolvable(int m, int[] arr, int i) {
if (i < 0 || arr[i] == 1) return false;
if ((i == arr.length - 1) || i + m > arr.length - 1) return true;
arr[i] = 1;
return isSolvable(m, arr, i + 1) || isSolvable(m, arr, i - 1) || isSolvable(m, arr, i + m);
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int q = scan.nextInt();
while (q-- > 0) {
int n = scan.nextInt();
int leap = scan.nextInt();
int[] game = new int[n];
for (int i = 0; i < n; i++) {
game[i] = scan.nextInt();
}
System.out.println( (canWin(leap, game)) ? "YES" : "NO" );
}
scan.close();
}
Hey @RodneyShag, I have saved most of all my Hackerank solutions and I would love to contribute them to this repo for the C++ solutions part. So can you let me know what I should do next?
The text was updated successfully, but these errors were encountered: