原创 Maximal Square
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. Fo
原创 Basic Calculator II
Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negativ
原创 Simplify Path
Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/.
原创 Restore IP Addresses(DFS的巔峯)
Given a string containing only digits, restore it by returning all possible valid IP address combinations. For examp
原创 Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each ope
原创 Number of Digit One(數學找規律)
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.
原创 Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The le
原创 Decode ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ...
原创 Ugly Number II
Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2,
原创 Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For exa
原创 Reverse Words in a String
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky
原创 Repeated DNA Sequences
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studyi
原创 Basic Calculator
Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and cl
原创 Contains Duplicate III
Given an array of integers, find out whether there are two distinct indices i and j in the array such that the differe
原创 Dungeon Game
https://leetcode.com/problems/dungeon-game/ public class Solution { public int calculateMinimumHP(int[][] dungeon)