Coding Challenges
Difficulty level - E-Easy, M-Medium, H-Hard
1. Sum Of Array Numbers (E)
You are given an array of two numbers [a,b]. Find the sum of those two numbers plus the sum of all the numbers between them.
// My Solution
const arr = [4, 1];
const sortedArr = arr.sort(); //sorts in asc order
let temp = 0;
for (let i = sortedArr[0]; i <= sortedArr[sortedArr.length - 1]; i++) {
temp += i;
}
console.log(temp);2. Factorial Of Numbers (E)
Give an integer (num), find the factorial of that integer.
3. Fibonacci Sequence (E)
Give a number n, find the first n elements of the Fibonacci series.
4. Find Prime Numbers (M)
Given two numbers min and max, find all the prime numbers in the range of min to max. (min and max included)
5. Is Palindrome (E)
Given a string (str), determine if it is a palindrome. A palindrome is a word, phrase, or sequence that reads the same backward as forwards, e.g. madam.
6. Is Anagram (M)
Given two strings (str1 and str2), determine if str1 is an anagram of str2. An Anagram is a word, phrase, or name formed by rearranging the letters of another, such as spar, formed from rasp.
spar, formed from rasp.7. Reverse Words (E)
Given an input string (str), reverse the string word by word.
8. Unique element/s in the array (M)
Find first occurred unique element/s in array
10. Remove Vowels from String (E)
Remove 'a','e','i','o',u'
11. Reverse Words (E)
Last updated