原创 59.螺旋數組第二彈
Spiral Matrix II 問題描述: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral ord
原创 61.鏈表旋轉
Rotate List 問題描述: Given a list, rotate the list to the right by k places, where k is non-negative. For example: Gi
原创 54.螺旋讀取數組
Spiral Matrix 問題描述: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spir
原创 60.全排列
Permutation Sequence 問題描述: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling
原创 55.jump遊戲
Jump Game 問題描述: Given an array of non-negative integers, you are initially positioned at the first index of the arr
原创 64.最小路徑和
Minimum Path Sum 問題描述: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom rig
原创 57.插入間隔
Insert Interval 問題描述: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if
原创 69.平方根函數
Sqrt(x) 問題描述: Implement int sqrt(int x). Compute and return the square root of x. 參考答案(c++): class Solution { publi
原创 52.多皇后問題第二彈
N-Queens II 問題描述: Follow up for N-Queens problem. Now, instead outputting board configurations, return the total nu
原创 56.合併間隔
Merge Intervals 問題描述: Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[
原创 68.文本格式化
Text Justification 問題描述: Given an array of words and a length L, format the text such that each line has exactly L
原创 50.實現冪函數
問題描述: Implement pow(x, n). 參考答案: class Solution { public: double myPow(double x, int n) { double ans =
原创 51.多皇后問題
# 問題描述: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack
原创 65.驗證數字
Valid Number 問題描述: Validate if a given string is numeric. Some examples: “0” => true ” 0.1 ” => true “abc” => fa
原创 63.尋找路徑第二彈
Unique Paths II 問題描述: Follow up for “Unique Paths”: Now consider if some obstacles are added to the grids. How many