# 分类：算法

## Leetcode - Valid Sudoku

My code: import java.util.HashSet; public class Solution { public boolean isValidSudoku(char[][] board) { if (…

## Leetcode - Climbing Stairs

My code: public class Solution { public int climbStairs(int n) { if (n <= 0) return 0; int[] dp = new int[n…

## Leetcode -Ugly Number II

My code: public class Solution { public int nthUglyNumber(int n) { if (n <= 0) return 0; else if (n == 1) r…

## Leetcode - Subsets II

My code: import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Solution { p…

## Leetcode - Convert Sorted Array to Binary Search Tree

Paste_Image.png My code: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeN…

## Leetcode - Word Search

My code: import java.util.HashSet; public class Solution { private int width = 0; private int height = 0; publ…

## Leetcode - Best Time to Buy and Sell Stock IV

My code: public class Solution { public int maxProfit(int k, int[] prices) { if (k <= 0 || prices == null |…

## Leetcode - Binary Tree Postorder Traversal

Paste_Image.png My code: import java.util.ArrayList; import java.util.List; /** * Definition for a binary tree…