How do you check a row in a 2D char array for a specific element and then count how many of that element are in the row? (Java)

PHOTO EMBED

Wed Apr 01 2020 08:24:35 GMT+0000 (Coordinated Universal Time)

Saved by @Gameron #java #java #2dchar array

private boolean oneQueenPerRow() {
    int foundQueens;
    for (int i = 0; i < board.length; i++) {
        foundQueens = 0;//each loop is a checked row
        for (int j = 0; j < board.length; j++) {
            if (board[i][j] == QUEEN)
                foundQueens++;
        }
        if (foundQueens > 1) return false;
    }
    return true;
}
content_copyCOPY

https://stackoverflow.com/questions/60963813/how-do-you-check-a-row-in-a-2d-char-array-for-a-specific-element-and-then-count