Word Pattern
Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between…
Move Zeroes
Given an integer array nums, move all 0‘s to the end of it while maintaining the relative order of the non-zero elements.…
Add Digits
Given an integer num, repeatedly add all its digits until the result has only one digit, and return it. Example…
Contains Duplicate II
Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <=…
Contains Duplicate
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Example…
Happy Number
Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with…
Excel Sheet Column Number
Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column number. For example: A…
Majority Element
Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You…
Climbing Stairs
You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many…