Container With Most Water
LeetCode https://leetcode.cn/problems/container-with-most-water/ class Solution { public int maxArea(int[] height) { int i = 0; int j = height.length - 1; int globalMax...
LeetCode https://leetcode.cn/problems/container-with-most-water/ class Solution { public int maxArea(int[] height) { int i = 0; int j = height.length - 1; int globalMax...
LeetCode https://leetcode.cn/problems/move-zeroes/ class Solution { public void moveZeroes(int[] nums) { if (nums == null || nums.length <= 1) { return; } ...
LeetCode https://leetcode.cn/problems/longest-consecutive-sequence/ class Solution { public int longestConsecutive(int[] nums) { Set<Integer> numSet = new HashSet<>(); ...
LeetCode https://leetcode.cn/problems/path-sum-iii/ naive /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * ...
Description LeetCode https://leetcode.cn/problems/lowest-common-ancestor-of-a-binary-tree/ Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to...
LeetCode https://leetcode.cn/problems/binary-tree-maximum-path-sum/ /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right...
LeetCode https://leetcode.cn/problems/flatten-binary-tree-to-linked-list/ /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode...
LeetCode https://leetcode.cn/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ Index 0 1 2 3 4 5 6 ...
LeetCode https://leetcode.cn/problems/binary-tree-right-side-view/ Iterative /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * Tree...
LeetCode https://leetcode.cn/problems/validate-binary-search-tree/ /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right;...