Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dynamicAlgo(X, Y, Z) {
- // Bail out fast
- if (x.size()+y.size() != z.size()){
- return
- }
- boolean[][] array a = new array;
- for (int i = 0; i < X.length) { //Vi gennemløber hele vores 2D array
- for (int j = 0; i < Y.length) { // -||-
- if (i >= 0 && j >= 0) {
- if (Z[i + j] == X[i] && a[i - 1][j]) {
- a[i][j] = true;
- }
- } else if (z[i + j] == y[j] && a[i][j - 1]) {
- a[i][j] = true;
- }
- if (i >= 1 && j == 0) {
- Z[i + j] = X[i];
- a[i][j] = true;
- }
- if (i == 0 && j >= 1) {
- Z[i + j] = Y[j];
- a[i][j] = true;
- }
- if (i == 0 && j == 0) {
- a[i][j] = true;
- }
- }
- }
- return a;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement