We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
function main() {
// Enter your code here
const input: string = readLine().trim();
let stack = new Stack();
let queue = new Queue();
for (let i =0; i
if (str1!==str2) {
isPallindrome = false;
break;
}
}
if (isPallindrome === true) {
console.log('The word, '+`${input}`+', is a palindrome.');
} else { console.log('The word, '+`${input}`+', is not a palindrome.');}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 18: Queues and Stacks
You are viewing a single comment's thread. Return to all comments →
Typescript do not have built in datatypes like stacks and queues, so you need to create them:
class Stack{ private items: T[];
}
class Queue { private items: T[];
}
function main() { // Enter your code here const input: string = readLine().trim(); let stack = new Stack(); let queue = new Queue(); for (let i =0; i
}