原创 LeetCode--No.322--Coin Change

322. Coin Change Medium 166272FavoriteShare You are given coins of different denominations and a total amount of money 

原创 LeetCode--No.88--Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume tha

原创 LeetCode--No.46--Permutations

Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3]

原创 LeetCode--No.49--Group Anagrams

我今天太累了,累到刷不動。 這道題抄的。有幾個常用的function, 但是我不是很記得清楚的 1. char[] ca = s.toCharArray() 2. String aaa = String.valueOf(ch) 3. re

原创 LeetCode--No.771-Jewels and Stones

雖然是很簡單的題,但是發現一個問題。 就是如何遍歷一個String更好一點 class Solution { public int numJewelsInStones(String J, String S) {

原创 LeetCode--No.560--Subarray Sum Equals K

Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals

原创 LeetCode--No.31--Next Permutation

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If

原创 LeetCode--No.1041--Robert Bounded in Circle

On an infinite plane, a robot initially stands at (0, 0) and faces north.  The robot can receive one of three instructi

原创 LeetCode--No.22--Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, gi

原创 LeetCode--No.33--Search in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] m

原创 LeetCode--No.138--Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the l

原创 LeetCode--No.11--Container With Most Water

Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines a

原创 LeetCode--No.253--Meeting Rooms II

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the mi

原创 LeetCode--No.15--3Sum

早上睡醒了不能玩手機啊,晚上睡覺的時候手機還是要放得遠一點。 抄了一道3sum. 有機會複習一下吧。 感覺以後即使用最笨的方法,也要寫出來跑一下纔可以。 要複習一下不同數據結構之間的轉換,晚上總結一下。 class Solution {

原创 LeetCode--No.973--K Closest Points to Origin

We have a list of points on the plane.  Find the K closest points to the origin (0, 0). (Here, the distance between two