Participated by Hayeong Pyeon and Daniya Yelemessova
- This is a whiteboard (technical interview preparation) session provided as an independent project of Epicodus.
- Each interviewee comes up with solutions for each challenge.
URLs cannot have spaces. Instead, all spaces in a string are replaced with %20. Write an algorithm that replaces all spaces in a string with %20.
You may not use the replace() method or regular expressions to solve this problem. Solve the problem with and without recursion.
Example Input: "Jasmine Ann Jones"
Expected Output: "Jasmine%20Ann%20Jones"
Write an algorithm that removes duplicates from an array. Do not use a function like filter() to solve this. Once you have solved the problem, demonstrate how it can be solved with filter(). Solve the problem with and without recursion.
Example Input: [7, 9, "hi", 12, "hi", 7, 53]
Expected Output: [7, 9, "hi", 12, 53]
Write an algorithm that takes a string with repeated characters and compresses them, using a number to show how many times the repeated character has been compressed. For instance, aaa would be written as 3a. Solve the problem with and without recursion.
Example Input: "aaabccdddda"
Expected Output: "3ab2c4da"
Write an algorithm that determines whether all the elements in a string are unique. You may not convert the string into an array or use array methods to solve this problem. The algorithm should return a boolean.
Example Input 1: "hello"
Expected Output 1: false
Example Input 2: "copyright"
Expected Output 2: true
Write an algorithm that sorts an array without using the sort() method. There are many different sorting algorithms — take the time to read about the following:
Quick sort Merge sort Heap sort Insertion sort Bubble sort Selection sort You may implement any of the above algorithms (or your own) to solve the problem — as long as it doesn't use sort().
Example Input: [9, 2, 7, 12]
Expected Output: [2, 7, 9, 12]
- Clone this repository to your desktop.
- Navigate to the top level of the directory.
- Open
index.html
in your browser. - Open Console to view return values of each function (solution created by participants).