Problem 1: Find the Missing Number in an Array
Given an array of consecutive numbers with one missing, find the missing number.
Example:
Input: [1, 2, 4, 5, 6]
Output: 3
Solution:
Problem 2: Reverse Words in a String
Write a function to reverse the order of words in a given string.
Example:
Input: "JavaScript is fun"
Output: "fun is JavaScript"
Solution:
Problem 3: Check if a String is a Palindrome
A palindrome is a word or phrase that reads the same forward and backward. Write a function to check if a given string is a palindrome.
Example:
Input: "madam"
Output: true
Solution:
Problem 4: FizzBuzz
Write a function that prints the numbers from 1 to 100. But for multiples of 3, print "Fizz" instead of the number, and for multiples of 5, print "Buzz". For numbers which are multiples of both 3 and 5, print "FizzBuzz".
Solution:
Problem 5: Remove Duplicates from an Array
Write a function to remove duplicates from an array.
Example:
Input: [1, 2, 2, 3, 4, 4, 5]
Output: [1, 2, 3, 4, 5]
Solution:
Top comments (0)