摘要:
class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> res = new ArrayList<>(); Arrays.sort(nums); for(int 阅读全文
摘要:
##O(n^3)解法 class Solution { public int sumOddLengthSubarrays(int[] arr) { int res = 0; int n = arr.length; for(int i=0;i<n;i++){ for(int j=i;j<n;j++){ 阅读全文
摘要:
##动态规划 class Solution { public int minimumOperations(String leaves) { int n = leaves.length(); int [][]state = new int[n][3]; char[] leaveArr = leaves 阅读全文
摘要:
class Solution { List<List<Integer>> res = new ArrayList<>(); List<Integer> list = new LinkedList<>(); public List<List<Integer>> combinationSum(int[] 阅读全文
摘要:
题目链接:https://leetcode-cn.com/problems/binary-tree-paths/ 前序遍历 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode 阅读全文
摘要:
题目链接:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/ ##题解:双指针 /** * Definition for singly-linked list. * public class ListNode { 阅读全文