原创 LeetCode - Read N Characters Given Read4 I && II
Read N Characters Given Read4 I https://leetcode.com/problems/read-n-characters-given-read4/ The API: int read4(char
原创 LeetCode - Distinct Subsequences
https://leetcode.com/problems/distinct-subsequences/ 這道題一開始我還想用 two pointers , backtracking來做,後來想這個是算個數,backtracking太複雜
原创 LeetCode - ZigZag Conversion
https://leetcode.com/problems/zigzag-conversion/ The string "PAYPALISHIRING" is written in a zigzag pattern on a give
原创 LeetCode - One Edit Distance
https://leetcode.com/problems/one-edit-distance/ Given two strings S and T, determine if they are both one edit distanc
原创 LeetCode - Merge Two Sorted Lists
https://leetcode.com/problems/merge-two-sorted-lists/ 這用到的就是merge sort裏面的merge函數,只不過這裏是在merge list。 public class Soluti
原创 LeetCode - Simplify Path
https://leetcode.com/problems/simplify-path/ Given an absolute path for a file (Unix-style), simplify it. For exampl
原创 LeetCode - Reverse Linked List II
https://leetcode.com/problems/reverse-linked-list-ii/ 這道題跟其他reverse node 的題差不多,只要找到需要reverse的node之前的那個node,再把這個node後面的n
原创 LeetCode - Edit Distance
https://leetcode.com/problems/edit-distance/ Given two words word1 and word2, find the minimum number of steps requir
原创 LeetCode - Maximum Depth of Binary Tree
https://leetcode.com/problems/maximum-depth-of-binary-tree/ Given a binary tree, find its maximum depth. The maximum
原创 LeetCode - Scramble String
https://leetcode.com/problems/scramble-string/ Given a string s1, we may represent it as a binary tree by partitionin
原创 LeetCode - Text Justification
https://leetcode.com/problems/text-justification/ Given an array of words and a length L, format the text such that e
原创 LeetCode - Validate Binary Search Tree
https://leetcode.com/problems/validate-binary-search-tree/ Given a binary tree, determine if it is a valid binary sea
原创 LeetCode - Wildcard Matching
https://leetcode.com/problems/wildcard-matching/ Implement wildcard pattern matching with support for '?' and '*'. '?
原创 LeetCode - Reverse Words in a String I && II
Reverse Words in a String I https://leetcode.com/problems/reverse-words-in-a-string/ 這道題O(n)的方法很簡單,就是遍歷字符串,找到一個詞就放到list
原创 LeetCode - Interleaving String
https://leetcode.com/problems/interleaving-string/ Given s1, s2, s3, find whether s3 is formed by the interleaving of