原创 【LeetCode 225】 Implement Stack using Queues
題目描述 Implement the following operations of a stack using queues. push(x) – Push element x onto stack. pop() – Remov
原创 【LeetCode 376】Wiggle Subsequence
題目描述 A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alter
原创 【LeetCode 402】 Remove K Digits
題目描述 Given a non-negative integer num represented as a string, remove k digits from the number so that the new numb
原创 【LeetCode 78】 Subsets
題目描述 Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set mu
原创 【LeetCode 455】Assign Cookies
題目描述 Assume you are an awesome parent and want to give your children some cookies. But, you should give each child
原创 【LeetCode 452】 Minimum Number of Arrows to Burst Balloons
題目描述 There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is
原创 【LeetCode 90】 Subsets II
題目描述 Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set
原创 【LeetCode 473】 Matchsticks to Square
題目描述 Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has,
原创 【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 eac
原创 【LeetCode 239】 Sliding Window Maximum
題目描述 Given an array nums, there is a sliding window of size k which is moving from the very left of the array to th
原创 【LeetCode 698】Partition to K Equal Sum Subsets
題目描述 Given an array of integers nums and a positive integer k, find whether it’s possible to divide this array into
原创 【LeetCode 209】 Minimum Size Subarray Sum
題目描述 Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarr
原创 【LeetCode 329】Longest Increasing Path in a Matrix
題目描述 Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move t
原创 【面試題 & LeetCode 367】 Valid Perfect Square
題目描述 判斷一個數是否是平方數。 思路 平方數可以拆成一個等差數列的和。 代碼 class Solution { public: bool isPerfectSquare(int num) { int c
原创 【LeetCode 474】 Ones and Zeroes
題目描述 Given an array, strs, with strings consisting of only 0s and 1s. Also two integers m and n. Now your task is t