Skip to content

Instantly share code, notes, and snippets.

@nsisodiya
Created October 20, 2018 09:50
Show Gist options
  • Select an option

  • Save nsisodiya/b5da06617543a161551e7842500b5e7e to your computer and use it in GitHub Desktop.

Select an option

Save nsisodiya/b5da06617543a161551e7842500b5e7e to your computer and use it in GitHub Desktop.
Find islands in Boolean Matrix
class Matrix {
constructor(n, m) {
this.numrows = n;
this.numcolumns = m;
this.generateMatrix();
}
generateMatrix() {
var rows = [];
for (var j = 0; j < this.numrows; j++) {
var columns = [];
for (var i = 0; i < this.numcolumns; i++) {
columns.push({
val: Math.round(Math.random()),
visited: false
});
}
rows.push(columns);
}
this.data = rows;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment