原创 LeetCode 刷題記錄 50. Pow(x, n)

題目: Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Input: 2.00000, 10 Output: 1024.

原创 LeetCode 刷題記錄 51. N-Queens

題目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each

原创 LeetCode 刷題記錄54. Spiral Matrix

題目: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Exampl

原创 LeetCode 刷題記錄 71. Simplify Path

題目: Given an absolute path for a file (Unix-style), simplify it. Or in other words, convert it to the canonical pat

原创 LeetCode 刷題記錄73. Set Matrix Zeroes

題目: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Example 1: Input:

原创 LeetCode 刷題記錄 60. Permutation Sequence

題目: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations

原创 LeetCode 刷題記錄 90. Subsets II

題目: Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set)

原创 LeetCode 刷題記錄 79. Word Search

題目: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of s

原创 LeetCode 刷題記錄61. Rotate List

題目: Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Input: 1->2-

原创 LeetCode 刷題記錄 77. Combinations

題目: Given two integers n and k, return all possible combinations of k numbers out of 1 … n. Example: Input: n = 4,

原创 LeetCode 刷題記錄 53. Maximum Subarray

題目: 53. Maximum Subarray Given an integer array nums, find the contiguous subarray (containing at least one number)

原创 LeetCode 刷題記錄 80. Remove Duplicates from Sorted Array II

題目: Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and retur

原创 LeetCode 刷題記錄74. Search a 2D Matrix

題目: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following proper

原创 LeetCode 刷題記錄 82. Remove Duplicates from Sorted List II

題目: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from th

原创 LeetCode 刷題記錄 56. Merge Intervals

題目: Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]