Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. dynamicAlgo(X, Y, Z) {
  2. // Bail out fast
  3. if (x.size()+y.size() != z.size()){
  4. return
  5. }
  6. boolean[][] array a = new array;
  7. for (int i = 0; i < X.length) { //Vi gennemløber hele vores 2D array
  8. for (int j = 0; i < Y.length) { // -||-
  9. if (i >= 0 && j >= 0) {
  10. if (Z[i + j] == X[i] && a[i - 1][j]) {
  11. a[i][j] = true;
  12. }
  13. } else if (z[i + j] == y[j] && a[i][j - 1]) {
  14. a[i][j] = true;
  15. }
  16. if (i >= 1 && j == 0) {
  17. Z[i + j] = X[i];
  18. a[i][j] = true;
  19. }
  20. if (i == 0 && j >= 1) {
  21. Z[i + j] = Y[j];
  22. a[i][j] = true;
  23. }
  24. if (i == 0 && j == 0) {
  25. a[i][j] = true;
  26. }
  27. }
  28. }
  29. return a;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement