Skip to content

Instantly share code, notes, and snippets.

// '[]{}()' - allowed characters
// Assusming that only above characters are used. Write a code to validate the given pattern.
// '[{[()]}]' - valid
// '[{[()]}]{[{()}]}' - valid
// '[()[]]'
// '[{[()]]}]' - not valid
// '[}' - not valid
// '[{]}' - not valid
// '[]{}' - valid
function sort(arr) {
let last_index = arr.length - 1;
while (last_index > 0) {
heapify(arr, last_index);
swap(0, last_index, arr);
last_index--;
}
return arr;
}
function heapify(arr, last_index) {
module.exports = req.random_number = Math.floor(Math.random()*10);