Telephone Number Validator

Return true if string str is US telephone number, false otherwise.

US telephone numbers look like these:

'(555) 555-5555', 
'555 555 5555', 
'1 555 555 5555', 
'1 (555) 555-5555', 
'1 456 789 4444'

But not like these:

"1 555)555-5555", 
"2 (757) …

Caesars Cipher

Convert string str into ROT13 cipher string. Returned string must be all uppercase letters.

My approach

function rot13(str) {
  return str.split('').map(char => rot(char)).join('')

  function rot(char) {
    const alphabets = …

Roman Numeral Converter


Write a function that takes number num and return corresponding Roman numeral.

For how Roman numeral works, see here.

My approach

function convertToRoman(num) {

    function getQuot(quot, dec) {
        let lowDec, fifth, highDec;
        switch (dec) {
            case …

Leap year


Write a python function that takes year and return True if it's leap year, False otherwise.

There are three conditions to determine whether it's leap year or not. Leap year is

  1. evenly divided by 4.
  2. And it is not evenly divided by 100.
  3. Even if the second condition fails, …

Palindrome Checker


Return true if string str is palindrome, false otherwise.

What is Palindrome?

According to wikipedia,

A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam or racecar. There are also numeric palindromes, including date/time stamps using …