原创 力扣leetcode 118. 楊輝三角 java

class Solution { public List<List<Integer>> generate(int numRows) { List<List<Integer>> result = new Ar

原创 力扣leetcode 5. 最長迴文子串 java

class Solution { public String longestPalindrome(String s) { if(s.length() == 0) return ""; in

原创 力扣leetcode 110. 平衡二叉樹 java

/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * T

原创 力扣leetcode 155. 最小棧 java

class MinStack { private Stack<Integer> S; private Stack<Integer> minS; /** initialize your data stru

原创 力扣leetcode 119. 楊輝三角 II java

class Solution { public List<Integer> getRow(int rowIndex) { List<Integer> result = new ArrayList();

原创 力扣leetcode 111. 二叉樹的最小深度 java

/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * T

原创 力扣leetcode 108. 將有序數組轉換爲二叉搜索樹 java

/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * T

原创 力扣leetcode 100. 相同的樹 java

/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * T

原创 力扣leetcode 88. 合併兩個有序數組 java

class Solution { public void merge(int[] nums1, int m, int[] nums2, int n) { int[] nums3 = new int[m];

原创 力扣leetcode 83. 刪除排序鏈表中的重複元素 java

/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * L

原创 力扣leetcode 107. 二叉樹的層次遍歷 II java

/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * T

原创 力扣leetcode 125. 驗證迴文串 java

class Solution { public boolean isLegal(char ch) { return Character.isLetter(ch) || Character.isDigit(

原创 力扣leetcode 167. 兩數之和 II - 輸入有序數組 java

class Solution { public int[] twoSum(int[] numbers, int target) { int index1 = 0, index2 = numbers.len

原创 力扣leetcode 2. 兩數相加 java

/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; *

原创 力扣leetcode 141. 環形鏈表 java

/** * Definition for singly-linked list. * class ListNode { * int val; * ListNode next; * ListNod