Check whether a string is contained in a char matrix in horizontal or vertical JAVA

Asked

Viewed 38 times

0

For the time being I’ve written this function

public static boolean isHidden(char[][] board, String word){
  boolean check = false;
  for(int i = 0; i < (board[0].length); i++){
    for(int j = 0; j<(board.length); j++){
     for(int m = 0; (j+m)<board.length); m++){
       //Check if beetween char[i][j] and char[i][i+m] the word is contained
       // if yes then ceck = true 
     }
    }
  }
}  

I don’t know if what I wrote is correct so far, but the problem is that I don’t know how to check whether the word is contained there or not. uq thought was to use Stringbuilder and append but only works with a one-dimensional array.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.