Climbing Stairs
You are climbing a staircase. It takes steps to reach the top.
Each time you can either climb or steps. In how many distinct ways can you climb to the top?
You are climbing a staircase. It takes steps to reach the top.
Each time you can either climb or steps. In how many distinct ways can you climb to the top?
Given a non-negative integer , return the square root of rounded down to the nearest integer. The returned integer should be non-negative as well.
You must not use any built-in exponent function or operator.
Given two binary strings and , return their sum as a binary string.
Example 1:
You are given a large integer represented as an integer array , where each is the digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading ‘s.
Increment the large integer by one and return the resulting array of digits.
Given a string consisting of words and spaces, return the length of the last word in the string.
A word is a maximal substring consisting of non-space characters only.
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You must write an algorithm with runtime complexity.
Given an integer array and an integer , remove all occurrences of in in-place. The relative order of the elements may be changed.
Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array . More formally, if there are elements after removing the duplicates, then the first elements of should hold the final result. It does not matter what you leave beyond the first elements.
26.Remove Duplicates from Sorted Array
Given an integer array sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same.
return after placing the final result in the first slots of .
You are given the heads of two sorted linked lists and .
Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists.
Given a string containing just the characters , , , , and , determine if the input string is valid.
An input string is valid if: