記錄: 2016/11

0

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

0

Add Binary

Add BinaryGiven two binary strings, return their sum (also a binary string). For Example:123a = "11"b = "1"Return "100". 提示 解題應用 String 觀查規律 Math 觀查規律 Defaul

0

Plus One

Plus OneGiven a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. 提示 解題應用 Ar

0

Length of Last Word

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

0

Count and Say

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

0

Valid Sudoku

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

0

Remove Element

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

0

Swap Nodes in Pairs

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

0

Remove Duplicates from Sorted Array

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

0

Merge Two Sorted Lists

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