Comparing version 0.1.34 to 0.1.35
@@ -11,2 +11,3 @@ import { PriorityQueue } from './priorityQueue'; | ||
import { twoSum, maxArea } from './array'; | ||
export { PriorityQueue, BinaryTree, BinaryNode, BST, quickSort, pivot, quickSelect, quickSelectPivot, binarySearch, binarySearchRange, searchRange, Graph, Dijkstra, Matrix, lengthOfLongestSubstring, backspaceCompare, isPalindrome, strip, isSubPalindrome, twoSum, maxArea, }; | ||
import { isValidParentheses, minRemoveToMakeValid } from './stack'; | ||
export { PriorityQueue, BinaryTree, BinaryNode, BST, quickSort, pivot, quickSelect, quickSelectPivot, binarySearch, binarySearchRange, searchRange, Graph, Dijkstra, Matrix, lengthOfLongestSubstring, backspaceCompare, isPalindrome, strip, isSubPalindrome, twoSum, maxArea, isValidParentheses, minRemoveToMakeValid, }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.maxArea = exports.twoSum = exports.isSubPalindrome = exports.strip = exports.isPalindrome = 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; | ||
exports.minRemoveToMakeValid = exports.isValidParentheses = exports.maxArea = exports.twoSum = exports.isSubPalindrome = exports.strip = exports.isPalindrome = 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"); | ||
@@ -35,1 +35,4 @@ Object.defineProperty(exports, "PriorityQueue", { enumerable: true, get: function () { return priorityQueue_1.PriorityQueue; } }); | ||
Object.defineProperty(exports, "maxArea", { enumerable: true, get: function () { return array_1.maxArea; } }); | ||
var stack_1 = require("./stack"); | ||
Object.defineProperty(exports, "isValidParentheses", { enumerable: true, get: function () { return stack_1.isValidParentheses; } }); | ||
Object.defineProperty(exports, "minRemoveToMakeValid", { enumerable: true, get: function () { return stack_1.minRemoveToMakeValid; } }); |
@@ -0,1 +1,5 @@ | ||
export type MapParenthesesType = { | ||
[key: string]: string; | ||
}; | ||
export declare function minRemoveToMakeValid(s: string): string; | ||
export declare function isValidParentheses(s: string): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.minRemoveToMakeValid = void 0; | ||
exports.isValidParentheses = exports.minRemoveToMakeValid = void 0; | ||
var MapParentheses = { | ||
'(': ')', | ||
'{': '}', | ||
'[': ']', | ||
}; | ||
function minRemoveToMakeValid(s) { | ||
return s; | ||
var chars = s.split(''); | ||
var stack = []; | ||
for (var i = 0; i < chars.length; i++) { | ||
if (chars[i] === '(') { | ||
stack.push(i); | ||
} | ||
else if (chars[i] === ')') { | ||
if (stack.length === 0) { | ||
chars[i] = ''; | ||
} | ||
else { | ||
stack.pop(); | ||
} | ||
} | ||
} | ||
for (var j = 0; j < stack.length; j++) { | ||
chars[stack[j]] = ''; | ||
} | ||
return chars.join(''); | ||
} | ||
exports.minRemoveToMakeValid = minRemoveToMakeValid; | ||
function isValidParentheses(s) { | ||
var stack = []; | ||
for (var i = 0; i < s.length; i++) { | ||
var parenthese = s[i]; | ||
if (MapParentheses[parenthese] !== undefined) { | ||
stack.push(parenthese); | ||
} | ||
else { | ||
var left = stack.pop(); | ||
if (left === undefined) { | ||
return false; | ||
} | ||
if (MapParentheses[left] !== parenthese) { | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
exports.isValidParentheses = isValidParentheses; |
{ | ||
"name": "flex-algo", | ||
"version": "0.1.34", | ||
"version": "0.1.35", | ||
"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
47785
1324