上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 41 下一页

2021年3月17日

Leet_Code_75_SortColor

摘要: public void sortColors(int[] nums) { int left = 0; int right = nums.length-1; for (int i=0;i<=right;i++) { if (nums[i] == 0) { swap(i,left,nums); left 阅读全文

posted @ 2021-03-17 07:55 MaXianZhe 阅读(32) 评论(0) 推荐(0) 编辑

Leet_Code_215_找第k大的数

摘要: public int findKthLargest(int[] nums, int k) { PriorityQueue<Integer> queue = new PriorityQueue<>(); for (int num : nums) { if (queue.size() < k) { qu 阅读全文

posted @ 2021-03-17 07:38 MaXianZhe 阅读(39) 评论(0) 推荐(0) 编辑

2021年3月16日

Leet_Code_42_接雨水

摘要: public int trap(int[] height) { int result = 0; int maxValue = -1; int maxAdder = 0; //取数组最大的下标和它的值 for (int i=0;i<height.length;i++) { if (height[i] 阅读全文

posted @ 2021-03-16 22:24 MaXianZhe 阅读(41) 评论(0) 推荐(0) 编辑

Leet_Code_137_唯一的数字

摘要: public int singleNumber(int[] nums) { int ans = 0; for (int i=0;i<32;i++) { int count = 0; for (int num : nums) { if (((num >>> i) &1) == 1) { count++ 阅读全文

posted @ 2021-03-16 22:20 MaXianZhe 阅读(51) 评论(0) 推荐(0) 编辑

Leet_Code_567_字符串排列

摘要: public static boolean checkInclusion(String s1, String s2) { int[] charArray1 = new int[26]; int[] charArray2 = new int[26]; for (char c : s1.toCharAr 阅读全文

posted @ 2021-03-16 19:09 MaXianZhe 阅读(37) 评论(0) 推荐(0) 编辑

LeetCode_424_替换后的最长字符串

摘要: class Solution { public int characterReplacement(String s, int k) { int left =0,right=0; int maxLength = -1; int result = 0; char[] charNums = new cha 阅读全文

posted @ 2021-03-16 18:39 MaXianZhe 阅读(30) 评论(0) 推荐(0) 编辑

LeetCode_139_单词拆分

摘要: class Solution { public boolean wordBreak(String s, List<String> wordDict) { return isContain(s, wordDict); } Map<String,Boolean> map = new HashMap<>( 阅读全文

posted @ 2021-03-16 18:38 MaXianZhe 阅读(35) 评论(0) 推荐(0) 编辑

2021年3月11日

Nginx的upstream

摘要: upstream zhang21(名称){ server 192.168.1.11:8888; server 192.168.1.22:8888; server 192.168.1.33:8888; } upstream表示一个集群 阅读全文

posted @ 2021-03-11 19:15 MaXianZhe 阅读(127) 评论(0) 推荐(0) 编辑

2021年3月9日

Pigeon源码跟踪之客户端获取服务

摘要: 在具体调用ServiceFactory.getService时,实际会调用serviceProxy.getProxy(invokerConfig),进一步调用AbstractServiceProxy#getProxy方法,这个方法的实现逻辑大致如下: 1 检查interface,url,protoc 阅读全文

posted @ 2021-03-09 15:55 MaXianZhe 阅读(84) 评论(0) 推荐(0) 编辑

创建线程安全的set的方法

摘要: Set addresses = Collections.newSetFromMap(new ConcurrentHashMap());完全是jdk提供的方法 阅读全文

posted @ 2021-03-09 14:45 MaXianZhe 阅读(225) 评论(0) 推荐(0) 编辑

上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 41 下一页

导航