MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / createAnswer

Method createAnswer

java/0051-n-queens.java:28–38  ·  view source on GitHub ↗
(boolean[][] board, ArrayList<String> ans)

Source from the content-addressed store, hash-verified

26 }
27
28 public void createAnswer(boolean[][] board, ArrayList<String> ans) {
29 for (int i = 0; i < board.length; i++) {
30 StringBuilder str = new StringBuilder();
31 for (int j = 0; j < board[0].length; j++) {
32 if (board[i][j]) {
33 str.append("Q");
34 } else str.append(".");
35 }
36 ans.add(str.toString());
37 }
38 }
39
40 public boolean isSafe(boolean[][] board, int row, int col) {
41 for (int i = 0; i < row; i++) {

Callers 1

queensMethod · 0.95

Calls 2

addMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected