I want to improve my performance in technical interviews. Thus I'm creating this "Blog" to track, a problem I work on each day. The language chosen for this is JavaScript. JavaScript being one of the most popular programming languages and generally one of the first languages a developer learns. I hope this "blog" also helps others solve problems.
The questions come from a variety of places arcoss the internet and books.
Given a string value, the program must return the reverse of the string.
I have only provided one solution to this problem. It used the built in functions of split(), reverse(), and join().
Return the factorial of the provided integer.
If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.
Factorials are often represented with the shorthand notation n!
For example: 5! = 1 * 2 * 3 * 4 * 5 = 120
No solution has current been given by me.
Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?
Write a function that takes a string as input and reverse only the vowels of a string.
Example 1: Given s = "hello", return "holle".
Example 2: Given s = "leetcode", return "leotcede".
Note: The vowels does not include the letter "y".
No current solution given by me.
Return the length of the longest word in the provided sentence.
Your response should be a number.
Note: Currently have one solution it use the sort() method.
This series will go through the basic creation of a linked list, the different types and problems are asked for linked list.
Similar format to linked lists.
Implement the following operations of a stack using queues.
push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Get the top element. empty() -- Return whether the stack is empty.
Notes: You must use only standard operations of a queue -- which means only push to back, peek/pop from front, size, and is empty operations are valid.
Depending on your language, queue may not be supported natively. You may simulate a queue by using a list or deque (double-ended queue), as long as you use only standard operations of a queue.
You may assume that all operations are valid (for example, no pop or top operations will be called on an empty stack).