前言:在使用order by时,经常出现Using filesort,因此对于此类sql语句需尽力优化,使其尽量使用Using index。 0.准备 #1.创建test表。 drop table if exists test; create table test( id int primary k ...
分类:
数据库 时间:
2020-05-03 21:55:25
阅读次数:
76
原文地址:https://medium.freecodecamp.org/service-workers-the-little-heroes-behind-progressive-web-apps-431cc22d0f16 作者:Flavio Copes 摘要:这篇文章简述service worke ...
分类:
其他好文 时间:
2020-05-03 21:46:16
阅读次数:
79
# ``` class Solution { public: int lengthOfLongestSubstring(string s) { unordered_map hash; int res = 0; for(int i = 0, j = 0; j 1) { while(i < j) { h... ...
分类:
其他好文 时间:
2020-05-03 20:08:28
阅读次数:
43
sql 里面的order by 在mysql 里面是如何实现的呢? 为了说明这问题,首先先创建一个表 CREATE TABLE ( int(11) NOT NULL, varchar(16) NOT NULL, varchar(16) NOT NULL, int(11) NOT NULL, PRIM ...
分类:
数据库 时间:
2020-05-03 18:57:11
阅读次数:
72
You are given an m * n matrix, mat, and an integer k, which has its rows sorted in non-decreasing order. You are allowed to choose exactly 1 element f ...
分类:
其他好文 时间:
2020-05-03 18:14:33
阅读次数:
59
题目: 解法: 方法一:递归 1 /* 2 // Definition for a Node. 3 class Node { 4 public: 5 int val; 6 vector<Node*> children; 7 8 Node() {} 9 10 Node(int _val) { 11 v ...
分类:
其他好文 时间:
2020-05-03 14:52:04
阅读次数:
50
题目: 解法: 中序遍历得到一个升序序列,将遍历的结果存在一个数组val中,然后用另一个数组diff存数组val中前后元素的差值,输出其中的最小值。 代码略微繁琐,欢迎提出优化建议。 1 /** 2 * Definition for a binary tree node. 3 * struct Tr ...
分类:
其他好文 时间:
2020-05-03 14:30:33
阅读次数:
57
显示锁的应用场景: 1.ReadWriteLock 读写分离:可以有效地减少锁竞争,以提升系统性能 2.中断锁,超时锁 Lock读写分离 读写分离简介: 1.读写锁:在同一时刻允许多个读线程访问,但是当写线程访问,所有的写线程和读线程均被阻塞。读写锁维护了一个读锁加一个写锁,通过读写锁分离的模式来保 ...
分类:
其他好文 时间:
2020-05-03 12:43:34
阅读次数:
70
问题描述:编写一个 SQL 查询,获取 Employee 表中第二高的薪水(Salary),如果不存在第二高的薪水,那么查询应返回 null 。 中间过程: 第一次: select IFNULL((select Salary from Employee order by Salary desc li ...
分类:
数据库 时间:
2020-05-03 11:04:22
阅读次数:
67
功能 示例 位运算 去掉最后一位 (101101->10110) x>>1 在最后加一个0 (101101->1011010) x<<1 在最后加一个1 (101101->1011011) x<<1+1 把最后一位变成1 (101100->101101) x|1 把最后一位变成0 (101101-> ...
分类:
其他好文 时间:
2020-05-03 01:21:38
阅读次数:
82