New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

flex-algo

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-algo - npm Package Compare versions

Comparing version 0.1.25 to 0.1.26

12

lib/matrix.d.ts

@@ -0,10 +1,12 @@

type MatrixValueType = string | number;
declare class Matrix {
private _matrix;
constructor(matrix: [][]);
sequence(): any[];
sequence(): MatrixValueType[];
private _dfs;
dfs(): any[];
bfs(): any[];
matrix(): [][];
dfs(): MatrixValueType[];
bfs(): MatrixValueType[];
matrix(): MatrixValueType[][];
numIslands(): number;
}
export { Matrix };
export { Matrix, MatrixValueType };

@@ -76,4 +76,38 @@ "use strict";

};
Matrix.prototype.numIslands = function () {
var count = 0;
for (var i = 0; i < this._matrix.length; i++) {
for (var j = 0; j < this._matrix[0].length; j++) {
if (this._matrix[i][j] === '1') {
count += 1;
var queue = [];
queue.push([i, j]);
while (queue.length > 0) {
var current = queue.shift();
if (current === undefined) {
continue;
}
var row = current[0];
var col = current[1];
if (row < 0 ||
row >= this._matrix.length ||
col < 0 ||
col >= this._matrix[0].length ||
this._matrix[row][col] === '0') {
continue;
}
this._matrix[row][col] = '0';
for (var i_1 = 0; i_1 < DIRECTIONS.length; i_1++) {
var newRow = DIRECTIONS[i_1][0] + row;
var newCol = DIRECTIONS[i_1][1] + col;
queue.push([newRow, newCol]);
}
}
}
}
}
return count;
};
return Matrix;
}());
exports.Matrix = Matrix;
{
"name": "flex-algo",
"version": "0.1.25",
"version": "0.1.26",
"description": "\"SDK for commonly used data structure and algorithms\"",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc