原创 LeetCode學習篇九——Coin Change

題目:You are given coins of different denominations and a total amount of money amount. Write a function to compute t

原创 LeetCode學習篇十三——Perfect Squares

題目:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which

原创 LeetCode學習篇十六——Best Time to Buy and Sell Stock

題目:Say you have an array for which the i^th element is the price of a given stock on day i. If you were only permit

原创 leetcode學習篇六——Binary Tree Paths

題目:Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2

原创 LeetCode學習篇十九——Climbing Stairs

題目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 st

原创 leetcode學習篇七——Find Minimum in Rotated Sorted Array

試了一些pick one功能,隨機選取了一道題,題目如下: 153. Find Minimum in Rotated Sorted Array Suppose a sorted array is rotated at some

原创 LeetCode學習篇一——Counting Bits

題目:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’

原创 LeetCode學習篇十八——Best Time to Buy and Sell Stock with Cooldown

題目:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to f

原创 leetcode學習篇四——Majority Element

題目如下: Given an array of size n, find the majority element. The majority element is the element that appears more t

原创 LeetCode學習篇十二——Count Numbers with Unique Digits

題目:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n. Example: Given n =

原创 leetcode學習篇十——Is Subsequence

題目:Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case En

原创 LeetCode學習篇十四——House Robber

題目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money st

原创 LeetCode學習篇十五——Unique Binary Search Trees

題目:Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? For example, Given n =

原创 LeetCode學習篇十一——Range Sum Query - Immutable

題目:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example:

原创 LeetCode學習篇八—— Arithmetic Slices

題目:A sequence of number is called arithmetic if it consists of at least three elements and if the difference betwee