Comparing version 0.1.29 to 0.1.30
@@ -9,3 +9,3 @@ import { PriorityQueue } from './priorityQueue'; | ||
import { Matrix } from './matrix'; | ||
import { lengthOfLongestSubstring } from './string'; | ||
export { PriorityQueue, BinaryTree, BinaryNode, BST, quickSort, pivot, quickSelect, quickSelectPivot, binarySearch, binarySearchRange, searchRange, Graph, Dijkstra, Matrix, lengthOfLongestSubstring, }; | ||
import { lengthOfLongestSubstring, backspaceCompare } from './string'; | ||
export { PriorityQueue, BinaryTree, BinaryNode, BST, quickSort, pivot, quickSelect, quickSelectPivot, binarySearch, binarySearchRange, searchRange, Graph, Dijkstra, Matrix, lengthOfLongestSubstring, backspaceCompare, }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lengthOfLongestSubstring = exports.Matrix = exports.Dijkstra = exports.Graph = exports.searchRange = exports.binarySearchRange = exports.binarySearch = exports.quickSelectPivot = exports.quickSelect = exports.pivot = exports.quickSort = exports.BST = exports.BinaryNode = exports.BinaryTree = exports.PriorityQueue = void 0; | ||
exports.backspaceCompare = exports.lengthOfLongestSubstring = exports.Matrix = exports.Dijkstra = exports.Graph = exports.searchRange = exports.binarySearchRange = exports.binarySearch = exports.quickSelectPivot = exports.quickSelect = exports.pivot = exports.quickSort = exports.BST = exports.BinaryNode = exports.BinaryTree = exports.PriorityQueue = void 0; | ||
var priorityQueue_1 = require("./priorityQueue"); | ||
@@ -28,1 +28,2 @@ Object.defineProperty(exports, "PriorityQueue", { enumerable: true, get: function () { return priorityQueue_1.PriorityQueue; } }); | ||
Object.defineProperty(exports, "lengthOfLongestSubstring", { enumerable: true, get: function () { return string_1.lengthOfLongestSubstring; } }); | ||
Object.defineProperty(exports, "backspaceCompare", { enumerable: true, get: function () { return string_1.backspaceCompare; } }); |
export declare function lengthOfLongestSubstring(s: string): number; | ||
export declare function backspaceCompare(source: string, target: string): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lengthOfLongestSubstring = void 0; | ||
exports.backspaceCompare = exports.lengthOfLongestSubstring = void 0; | ||
function lengthOfLongestSubstring(s) { | ||
@@ -23,1 +23,36 @@ if (s.length === 0) { | ||
exports.lengthOfLongestSubstring = lengthOfLongestSubstring; | ||
function backspaceCompare(source, target) { | ||
var p1 = source.length - 1; | ||
var p2 = target.length - 1; | ||
while (p1 >= 0 && p2 >= 0) { | ||
if (source[p1] === '#') { | ||
// backspace | ||
var backtrace = 2; | ||
while (backtrace > 0) { | ||
p1 -= 1; | ||
backtrace -= 1; | ||
if (source[p1] === '#') { | ||
backtrace += 2; | ||
} | ||
} | ||
} | ||
if (target[p2] === '#') { | ||
// backspace | ||
var backtrace = 2; | ||
while (backtrace > 0) { | ||
p2 -= 1; | ||
backtrace -= 1; | ||
if (source[p2] === '#') { | ||
backtrace += 2; | ||
} | ||
} | ||
} | ||
if (source[p1] !== target[p2]) { | ||
return false; | ||
} | ||
p1 -= 1; | ||
p2 -= 1; | ||
} | ||
return p1 === p2; | ||
} | ||
exports.backspaceCompare = backspaceCompare; |
{ | ||
"name": "flex-algo", | ||
"version": "0.1.29", | ||
"version": "0.1.30", | ||
"description": "\"SDK for commonly used data structure and algorithms\"", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42915
1178