logo.jpg

WebAssembly初识

由来 JavaScript性能问题 JIT TypeScript asm.js取JS子集 技术的规范统一是Web的宗旨 是什么 WebAssembly是一种新的字节码格式,是一

JavaScript的构造函数和原型链

构造函数 var Vehicle = function () { 'use strict'; this.price = 1000; }; 是函数 首字母通常大写 使用了this,代表对象实例 生成对象使用new new 创建空对象 将空对象的原型指向构造函数的p

网络缓存

缓存 数据库缓存、服务器缓存(代理服务器缓存、CDN缓存)、浏览器缓存(HTTP缓存、indexDB、cookie、localstorage)

一文读懂计算机网络协议

计算机网络体系架构 OSI架构(七层)、TCP/IP架构(4层,应用、运输、网际、网络接口)、五层体系架构 UDP(User Datagram Protocol) 用户数据报协议 UDP通过端口号

关于加密的二三事

ssh 一种网络协议,存在多种实现 用于远程登录 中间人攻击 SSH协议的公钥是没有证书中心(CA)公证的,都是自己签发的。攻击者可截获登录请求,冒充远

三个月算法进阶--day90

数据流中的中位数 class MedianFinder: def __init__(self): """ initialize your data structure here. """ self.max = [] self.min = [] def addNum(self, num: int) -> None: if len(self.max) > len(self.min): heapq.heappush(self.min, -heapq.heappushpop(self.max, num)) else: heapq.heappush(self.max, -heapq.heappushpop(self.min, -num)) def findMedian(self) -> float: if len(self.max) == len(self.min): return (self.max[0] - self.min[0]) / 2 else: return self.max[0] 把数组排成最小的数 class Solution:

三个月算法进阶--day89

剪绳子 class Solution: def cuttingRope(self, n: int) -> int: if n <=3: return n-1 a, b = n // 3, n % 3 if b == 0: return int(math.pow(3, a)) elif b == 1: return int(math.pow(3, a-1)) * 4 else: return int(math.pow(3, a)) * 2 快速幂求余 res = 1 while n: # n为指数 if n % 2: res = (res *

三个月算法进阶--day88

多数元素 class Solution: def majorityElement(self, nums): count = 0 candidate = None for num in nums: if count == 0: candidate = num count += (1 if num == candidate else -1) return candidate 反转链表 class Solution(object): def reverseList(self, head): """ :type head: ListNode :rtype: ListNode """ if not head or not head.next: return head cur = self.reverseList(head.next) head.next.next = head head.next = None

三个月算法进阶--day87

子集 class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: def backtrack(first = 0, curr = []): if len(curr) == k: output.append(curr[:]) for i in range(first, n): curr.append(nums[i]) backtrack(i + 1, curr) curr.pop() output = [] n = len(nums) for k in range(n + 1): backtrack() return output 二叉树最大路径和 class Solution: def __init__(self): self.ans = float("-inf") def maxPathSum(self, root: TreeNode) -> int: def