摘要: 1. WebSocket协议是 : 基于TCP的一种新的网络协议。它实现了浏览器与服务器全双工(full-duplex)通信——可以通俗的解释为服务器主动发送信息给客户端. 2. 区别于MQTT、XMPP等聊天的应用层协议: 它是一个传输通讯协议。它有着自己一套连接握手,以及数据传输的规范 3 SR 阅读全文
posted @ 2021-07-12 15:37 syh-918 阅读(581) 评论(0) 推荐(0)
摘要: public class _42_接雨水 { /** * 空间复杂度O(1),时间复杂度O(n) */ public int trap(int[] height) { if (height == null || height.length == 0) return 0; int lastIdx = 阅读全文
posted @ 2021-07-06 16:40 syh-918 阅读(41) 评论(0) 推荐(0)
摘要: /** * https://leetcode-cn.com/problems/container-with-most-water/ */public class _11_盛最多水的容器 { public int maxArea(int[] height) { if (height == null | 阅读全文
posted @ 2021-07-06 16:24 syh-918 阅读(68) 评论(0) 推荐(0)
摘要: /** * https://leetcode-cn.com/problems/meeting-rooms-ii/ */public class _253_会议室_II { public int minMeetingRooms(int[][] intervals) { if (intervals == 阅读全文
posted @ 2021-07-06 14:51 syh-918 阅读(91) 评论(0) 推荐(0)
摘要: /** * https://leetcode-cn.com/problems/meeting-rooms/ */public class _252_会议室 { public boolean canAttendMeetings(int[][] intervals) { if (intervals == 阅读全文
posted @ 2021-07-06 14:42 syh-918 阅读(82) 评论(0) 推荐(0)
摘要: /** * https://leetcode-cn.com/problems/reverse-integer/ */public class _7_整数反转 { public int reverse1(int x) { long res = 0; while (x != 0) { res = res 阅读全文
posted @ 2021-07-06 14:07 syh-918 阅读(46) 评论(0) 推荐(0)
摘要: /** * https://leetcode-cn.com/problems/lru-cache/ */public class _146_LRU缓存机制 { public static void main(String[] args) { LRUCache cache = new LRUCache 阅读全文
posted @ 2021-07-06 13:39 syh-918 阅读(36) 评论(0) 推荐(0)
摘要: /** * https://leetcode-cn.com/problems/spiral-matrix/ */public class _54_螺旋矩阵 { public List<Integer> spiralOrder(int[][] matrix) { if (matrix == null) 阅读全文
posted @ 2021-07-06 13:19 syh-918 阅读(37) 评论(0) 推荐(0)
摘要: /** * https://leetcode-cn.com/problems/yuan-quan-zhong-zui-hou-sheng-xia-de-shu-zi-lcof/ */ 环形链表-约瑟夫环public class 面试题_62_圆圈中最后剩下的数字 { // f(n, m) = (f( 阅读全文
posted @ 2021-07-06 11:04 syh-918 阅读(62) 评论(0) 推荐(0)
摘要: /** * https://leetcode-cn.com/problems/powx-n/ */public class _50_Pow { // T(n) = T(n/2) + O(1) = O(logn) public double myPow2(double x, int n) { if ( 阅读全文
posted @ 2021-07-06 10:24 syh-918 阅读(76) 评论(0) 推荐(0)