Climbing Stairs
Climbing StairsYou are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 提示 解題應用 Dyn
Climbing StairsYou are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 提示 解題應用 Dyn
Add BinaryGiven two binary strings, return their sum (also a binary string). For Example:123a = "11"b = "1"Return "100". 提示 解題應用 String 觀查規律 Math 觀查規律 Defaul
Length of Last WordGiven a string s consists of upper/lower-case alphabets and empty space characters ‘ ‘, return the length of last word in the string. If the last word does not exist, return 0. Not
Count and SayThe count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, … 1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21 is read off a
Valid SudokuThe Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. Note: A valid Sudoku board (partially filled) is not necessarily solvable. Only the fille
Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with constant
Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head. For example: 1Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm s
Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another arra
Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 提示 解題應用 LinkedList Pointer