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…
LeetCode Sqrt(x) solution
Given a non-negative integer x, compute and return the square root of x. Since the return type is an integer, the decimal digits are truncated, and…
LeetCode Add Binary Solution
Given two binary strings a and b, return their sum as a binary string. Example 1: Input: a = “11”, b = “1” Output:…
Leetcode Plus One solution
You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from…
Leetcode Length of Last Word solution
Given a string s consisting of some words separated by some number of spaces, return the length of the last word in the string. A word is a…