2022年3月17日
摘要:
package leetcode; import java.util.Arrays; public class offer_61 { public boolean isStraight(int[] nums) { //先进行排序 Arrays.sort(nums); int count=0; for
阅读全文
posted @ 2022-03-17 11:26
一仟零一夜丶
阅读(29)
推荐(0)
2022年3月16日
摘要:
package leetcode; public class offer_36 { //全局变量保存头结点和上一个结点 Node preNode,head; public Node treeToDoublyList(Node root) { if(root==null) { return null;
阅读全文
posted @ 2022-03-16 19:31
一仟零一夜丶
阅读(12)
推荐(0)
摘要:
package leetcode; import java.util.ArrayList; public class offer_54 { public int kthLargest(TreeNode root, int k) { //二叉搜索树的中序遍历是有序的 ArrayList<Integer
阅读全文
posted @ 2022-03-16 11:29
一仟零一夜丶
阅读(23)
推荐(0)
摘要:
package leetcode; import java.util.ArrayList; import java.util.List; public class offer_34 { public List<List<Integer>> pathSum(TreeNode root, int tar
阅读全文
posted @ 2022-03-16 10:56
一仟零一夜丶
阅读(23)
推荐(0)
2022年3月15日
摘要:
package leetcode; public class offer_13 { //全局变量记录总数 int count=0; public int movingCount(int m, int n, int k) { //防止重复计数 int[][] visit=new int[m][n];
阅读全文
posted @ 2022-03-15 11:43
一仟零一夜丶
阅读(19)
推荐(0)
摘要:
package leetcode; public class offer_12 { //设置全局变量 int flag=0; public boolean exist(char[][] board, String word) { if(board==null) {return false;} int
阅读全文
posted @ 2022-03-15 11:01
一仟零一夜丶
阅读(17)
推荐(0)
2022年3月14日
摘要:
package leetcode; import java.util.Stack; public class offer_58_1 { /* public String reverseWords(String s) { //先翻转整体再翻转局部 StringBuffer sb=new StringB
阅读全文
posted @ 2022-03-14 11:36
一仟零一夜丶
阅读(28)
推荐(0)
摘要:
package leetcode; public class offer_57 { public int[] twoSum(int[] nums, int target) { int[] arr=new int[2]; int left=0; int right=nums.length-1; whi
阅读全文
posted @ 2022-03-14 10:38
一仟零一夜丶
阅读(18)
推荐(0)
摘要:
package leetcode; public class offer_21 { public int[] exchange(int[] nums) { int left=0; int right=nums.length-1; int temp; while(left<right) { //如果是
阅读全文
posted @ 2022-03-14 09:58
一仟零一夜丶
阅读(6)
推荐(0)
2022年3月13日
摘要:
package leetcode; public class offer_25 { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { //创建一个新表头 ListNode node=new ListNode(); ListNode t
阅读全文
posted @ 2022-03-13 17:33
一仟零一夜丶
阅读(18)
推荐(0)