ruijiege

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  346 随笔 :: 0 文章 :: 8 评论 :: 12万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

07 2021 档案

摘要:/** * 因为求第三大的数,所以需要一个指针存放第三大的 * 如果后面的数大于最大数和第二大的数都需要把最大数,第二大,的数移动 * @param nums * @return */ public static int thirdMax(int[] nums) { if (nums.length= 阅读全文
posted @ 2021-07-31 08:13 哦哟这个怎么搞 阅读(25) 评论(0) 推荐(0) 编辑

摘要:public ListNode middleNode(ListNode head) { ListNode slow =head, fast =head; while (fast!=null || fast.next != null){ slow = slow.next; fast = fast.ne 阅读全文
posted @ 2021-07-31 07:20 哦哟这个怎么搞 阅读(28) 评论(0) 推荐(0) 编辑

摘要:public static void rotate(int[] nums, int k) { k = k%nums.length; reverse(nums,0,nums.length); reverse(nums,0,k); reverse(nums,k,nums.length); } publi 阅读全文
posted @ 2021-07-30 22:07 哦哟这个怎么搞 阅读(27) 评论(0) 推荐(0) 编辑

摘要:/** * 思想简单,用一个指针指向第二个重复的字符即可,然后判断每一段的大小,通过map保存没有重复字符的索引 */ public static int lengthOfLongestSubstring(String s) { int pre=0,maxlen=0; Map<Character, 阅读全文
posted @ 2021-07-29 22:44 哦哟这个怎么搞 阅读(30) 评论(0) 推荐(0) 编辑

摘要:public static int[] twoSum(int[] nums, int target) { Map<Integer,Integer> map = new HashMap(); int[] a = new int[2]; for (int i = 0; i < nums.length; 阅读全文
posted @ 2021-07-23 16:59 哦哟这个怎么搞 阅读(32) 评论(0) 推荐(0) 编辑

摘要:public static int[] sortedSquares(int[] nums) { //定义一个双指针 int left=0,right=nums.length-1; int[] res = new int[right+1]; //因为新数组需要排序 for (int i = nums. 阅读全文
posted @ 2021-07-23 16:39 哦哟这个怎么搞 阅读(24) 评论(0) 推荐(0) 编辑

摘要:https://leetcode-cn.com/problems/first-bad-version/ public int firstBadVersion(int n) { int left=0,right=n,mid; while (left<right){ mid = ((right-left 阅读全文
posted @ 2021-07-22 17:47 哦哟这个怎么搞 阅读(21) 评论(0) 推荐(0) 编辑

摘要:public static int search(int[] nums, int target) { //双指针 int left=0,right=nums.length-1; int mid=0; int res = -1; while (left<=right){ //防止int溢出如果是写为( 阅读全文
posted @ 2021-07-22 17:40 哦哟这个怎么搞 阅读(31) 评论(0) 推荐(0) 编辑

摘要:package cn.jiedada.controller; import java.util.ArrayList; import java.util.List; import java.util.Stack; /** * 爬楼梯 */ class Solution { public static 阅读全文
posted @ 2021-07-20 20:03 哦哟这个怎么搞 阅读(28) 评论(0) 推荐(0) 编辑

摘要:package cn.jiedada.controller; import java.util.ArrayList; import java.util.List; import java.util.Stack; /** * 数的中序遍历 */ class Solution { public stat 阅读全文
posted @ 2021-07-20 19:33 哦哟这个怎么搞 阅读(21) 评论(0) 推荐(0) 编辑

摘要:三个概念:最有子结构,边界,状态转化 https://www.cnblogs.com/cthon/p/9251909.html 爬楼梯问题 public static int getWay(int i) { if (i<1){ return 1; } if (i==1){ return 1; } i 阅读全文
posted @ 2021-07-20 08:41 哦哟这个怎么搞 阅读(23) 评论(0) 推荐(0) 编辑

摘要:package cn.jiedada.controller; import java.util.ArrayList; import java.util.List; import java.util.Stack; /** * 数的中序遍历 */ class Solution { public List 阅读全文
posted @ 2021-07-20 08:07 哦哟这个怎么搞 阅读(78) 评论(0) 推荐(0) 编辑

摘要:package cn.jiedada.controller; /** * 两数相加 * */ class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { //临时变量存储数据 ListNode p1=l1, p 阅读全文
posted @ 2021-07-15 11:31 哦哟这个怎么搞 阅读(43) 评论(0) 推荐(0) 编辑

摘要:package cn.jiedada.controller; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; public class TestABC { p 阅读全文
posted @ 2021-07-14 10:56 哦哟这个怎么搞 阅读(76) 评论(0) 推荐(0) 编辑

摘要:package cn.jiedada.controller; import java.util.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; public class MyTe 阅读全文
posted @ 2021-07-14 10:15 哦哟这个怎么搞 阅读(73) 评论(0) 推荐(0) 编辑

摘要:package cn.jiedada.controller; import java.util.*; import java.util.concurrent.atomic.AtomicReference; public class MyTest { public static void main(S 阅读全文
posted @ 2021-07-14 08:03 哦哟这个怎么搞 阅读(58) 评论(0) 推荐(0) 编辑

摘要:package cn.jiedada.controller; /** * 懒汉单列模式详细 */ public class A { private A(){ } //volatile防止重排序 private volatile static A instance = null; //synchron 阅读全文
posted @ 2021-07-13 22:00 哦哟这个怎么搞 阅读(36) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示