// class Promise {
// state = "pending";
// constructor() {}
// resolve(fn) {}
// }
// const promise = new Promise();
// function debounce(fn, time) {
// setTimeout(() => {
// fn();
// }, time);
// }
// const consoleDebounce = debounce(() => console.log("Called debounce"), 1000);
// for (let i = 0; i < 100; i++) {
// consoleDebounce();
// }
// Function Requirements:
// 1. Actual Url to shorten, get a shortned url
// 2. Give a shortened url and return the actual url
// Non Function Requirements:
// 1. 1M hits per day
// 2. Expiry url - 1 month
// const input = "{[]}";
// const isBalanced = (inputStr) => {
// const startingBrackets = ["{", "[", "("];
// const closingBrackets = ["}", "]", ")"];
// const startCloseMapping = {
// "(": ")",
// "[": "]",
// "{": "}",
// };
// const stack = [];
// for (let index = 0; index < inputStr.length; index++) {
// const element = inputStr[index];
// if (startingBrackets.includes(element)) {
// stack.push(element);
// } else if (closingBrackets.includes(element)) {
// const topElement = stack.pop();
// if (startCloseMapping[topElement] !== element) {
// return false;
// }
// }
// }
// return true;
// };
// console.log(isBalanced(input));
/*
1 => 2 => 3 => 4 => 5
2 => 4
*/
/*
counter = 5 (number of nodes)
removing = 5 - 2 = 3 (substracting length - last index) = index of the node
*/