面试问题整理

技术类:
1、redis如何水平扩展(一致性哈希)
2、parallelStream使用中的问题(线程安全,聚合与否,共享线程池问题)
3、dubbo的实现原理,调用过程,dubbo异步调用实现
4、future原理
5、jvm加载过程(校验,加载,空间分配,静态变量,静态方法等)
6、双亲委派机制
7、线程池常用核心参数,以及设置原因(IO密集型线程,CPU密集型线程)
8、redis为什么单线程,如何保证效率的(单线程只是用来连接)
9、redis的一些命令
10、redis的数据类型
11、jstack,jmap等线上排查问题工具,用法
12、Linux常用命令 (z)grep ,cat ,sed ,awk ,wc(统计),去重等
13、如何查看异常挂掉的进程日志
14、数据库事务 隔离级别,默认隔离级别,实现原理(mvvp)
15、数据库索引 主键索引,单列索引,组合索引,唯一索引(聚簇索引),覆盖索引;全文索引(非聚簇索引);命中逻辑,结构(B+树,适合区间查询,只在叶子节点存有数据,单节点能存更多数据,减少IO)
16、锁:乐观锁,悲观锁,各种锁,以及不同应用(如JAVA,MySQL)中的实现喝可用库
17、数组下标,为什么从0开始?数组的地址真的是连续的嘛?数组在栈还是堆上?(栈,jvm内存模型)多个进程共享的时候,如何保证数组在内存中的地址是连续的?
18、hashmap的推演及变形问题
19、spring 事务(@Transanctional)的实现原理
20、mysql事务索引,mysql非唯一索引条件下update的加锁问题
21、redis高并发多操作实现事务方案(lua脚本)

方案类:
1、分布式锁
2、幂等(最终一致性)
3、128位数字加减问题(数据结构如何设计,用什么基础类型,位数是否足够,怎么处理符号位)
4、计算10000或者更大数字的阶乘问题(算法,溢出,如何判断溢出)
5、实现手机后四位查找功能
6、

技能:
1、load飙高的常见排查思路

来自 Google 官方的代码评审最佳实践-摘录

  • 文章地址
  • CR的标准
  • 在 CR 中要看些什么
  • 如何浏览这次改动(CL)
  • Review 的速度
  • CR 要多快?
  • 速度 vs 中断
  • 快速回应

文章地址

原文地址:https://mp.weixin.qq.com/s/zIiDk7rcIKgvqh0YAvQPaA

英文地址:https://github.com/google/eng-practices/

CR的标准

  • Reviewer 有责任保证CL的质量,作为Review的代码的Owner
  • Reviewer不应追求完美,而应追求持续改进
  • CR要具有指导意义
  • 代码风格应该与现有的一致。如果项目没有统一风格,那就接受作者的风格
  • 解决冲突难以达成共识时,需要面对面或者拉起更大的团队讨论,带上Leader

在 CR 中要看些什么

  • 代码经过完善的设计
  • 功能性对于使用者们是好的
  • 对于任何UI改动要合理且好看
  • 任何并行编程的实现是安全
  • 代码不应该复杂超过原本所必须的
  • 开发者不该实现一个现在不用而未来可能需要的功能
  • 代码有适当的单元测试
  • 测试经过完善的设计
  • 开发者对于每样东西有使用清晰、明了的命名
  • 注释要清楚且有用,并只用来解释why而非what
  • 代码有适当的写下文件(一般在g3doc)
  • 代码风格符合style guide
  • 确保你查看被要求review的每一行代码、确认上下文、确保你正在改善代码质量,并赞扬开发人员所做的好事与优点吧!

如何浏览这次改动(CL)

步骤1: 用宏观的角度来看待改动,查看CL描述以及它做什么步骤2: 检查CL主要的部分步骤3: 用合理的顺序看CL 其余的改动

Review 的速度

为什么 Review 速度要快?

在Google我们优化开发团队 共同生产产品的速度,而不是优化个人开发的速度。个人的开发速度很重要,但它不如整个团队的开发速度重要。

CR 如果很慢,则:

①、团队整体的速度下降。

②、开发人员开始抗议 cr。

③、代码质量会收到影响。review 慢时,开发者提交的压力大。

CR 要多快?

如果你并没有处于需要专注工作的时候,那么应该在 review 完后尽快修改。回复最长的极限是一个工作日。

速度 vs 中断

我们可以在投入到处理他人给的review评论之前,找个适当的时机点来进行cr。这有可能是当你的当前开发任务完成后、午餐、刚从会议脱身或从微型厨房回来等等。

快速回应

个人回应评论的速度,比起让整个 cr 过程快速结束更重要。

 若在整个过程中能快速获得来自 reviewer 的回应,大大减轻开发者对缓慢 cr 过程的挫败感。

 reviewer员要花足够的时间来进行review,确保他们给出的LGTM,意味着“此代码符合我们的标准”。

 理想的个人的回应速度还是越快越好。

算法题题库

序号题号题名难度URL标签备注
17171比特与2比特字符简单https://leetcode-cn.com/problems/1-bit-and-2-bit-characters/数组简单,使用过
250Pow(x, n)中等https://leetcode-cn.com/problems/powx-n数学,二分查找简单,使用过 
469x 的平方根简单https://leetcode-cn.com/problems/sqrtx/数学,二分查找简单,使用过注意边界,不能用库函数
51006笨阶乘中等https://leetcode-cn.com/problems/clumsy-factorial数学简单,使用过
6984不含 AAA 或 BBB 的字符串中等https://leetcode-cn.com/problems/string-without-aaa-or-bbb贪心算法中等,使用过 
8299猜数字游戏中等https://leetcode-cn.com/problems/bulls-and-cows哈希表中等,使用过 
14849到最近的人的最大距离简单https://leetcode-cn.com/problems/maximize-distance-to-closest-person/数组简单,使用过 
18236二叉树的最近公共祖先中等https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree中等 
19111二叉树的最小深度简单https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/树,深度优先搜索,广度优先搜索简单
24560和为K的子数组中等https://leetcode-cn.com/problems/subarray-sum-equals-k数组,哈希表简单,使用过
4961旋转链表中等https://leetcode-cn.com/problems/rotate-list链表,双指针简单
7354螺旋矩阵中等https://leetcode-cn.com/problems/spiral-matrix/数组中等,使用过
7471简化路径中等https://leetcode-cn.com/problems/simplify-path/submissions/栈,字符串简单,使用过
51468验证IP地址中等https://leetcode-cn.com/problems/validate-ip-address字符串简单,使用过
56678有效的括号字符串中等https://leetcode-cn.com/problems/valid-parenthesis-string字符串中等,使用过 
64459重复的子字符串简单https://leetcode-cn.com/problems/repeated-substring-pattern/字符串简单,使用过
2393复原IP地址中等https://leetcode-cn.com/problems/restore-ip-addresses字符串,回溯算法中等 
3222括号生成中等https://leetcode-cn.com/problems/generate-parentheses字符串,回溯算法中等
4046全排列中等https://leetcode-cn.com/problems/permutations回溯算法简单,使用过
6677组合中等https://leetcode-cn.com/problems/combinations回溯算法简单
63149直线上最多的点数困难https://leetcode-cn.com/problems/max-points-on-a-line/哈希表,数学中等,使用过
483无重复字符的最长子串中等https://leetcode-cn.com/problems/longest-substring-without-repeating-characters哈希表,双指针,字符串,Slinding Window 
9372超级次方中等https://leetcode-cn.com/problems/super-pow数学
57367有效的完全平方数简单https://leetcode-cn.com/problems/valid-perfect-square/数学,二分查找简单
44495提莫攻击中等https://leetcode-cn.com/problems/teemo-attacking数组简单
41746使用最小花费爬楼梯简单https://leetcode-cn.com/problems/min-cost-climbing-stairs/数组,动态规划 
4333搜索旋转排序数组中等https://leetcode-cn.com/problems/search-in-rotated-sorted-array数组,二分查找简单
6739组合总和中等https://leetcode-cn.com/problems/combination-sum数组,回溯算法简单
68670最大交换中等https://leetcode-cn.com/problems/maximum-swap数组,数学中等,使用过
50287寻找重复数中等https://leetcode-cn.com/problems/find-the-duplicate-number数组,双指针,二分查找 
60209长度最小的子数组中等https://leetcode-cn.com/problems/minimum-size-subarray-sum数组,双指针,二分查找 
28134加油站中等https://leetcode-cn.com/problems/gas-station贪心算法 
38321拼接最大数困难https://leetcode-cn.com/problems/create-maximum-number/贪心算法,动态规划 
26991坏了的计算器中等https://leetcode-cn.com/problems/broken-calculator贪心算法,数学中等,使用过
291053交换一次的先前排列中等https://leetcode-cn.com/problems/previous-permutation-with-one-swap贪心算法,数组 
4555跳跃游戏中等https://leetcode-cn.com/problems/jump-game贪心算法,数组中等 
65784字母大小写全排列简单https://leetcode-cn.com/problems/letter-case-permutation/位运算,回溯算法 
39169求众数简单https://leetcode-cn.com/problems/majority-element/位运算,数组,分治算法简单,使用过
52331验证二叉树的前序序列化中等https://leetcode-cn.com/problems/verify-preorder-serialization-of-a-binary-tree中等,使用过
341019链表中的下一个更大节点中等https://leetcode-cn.com/problems/next-greater-node-in-linked-list栈,链表 
5520有效的括号简单https://leetcode-cn.com/problems/valid-parentheses/栈,字符串简单 
37148排序链表中等https://leetcode-cn.com/problems/sort-list/排序,链表 
35518零钱兑换 II中等https://leetcode-cn.com/problems/coin-change-2/
54794有效的井字游戏中等https://leetcode-cn.com/problems/valid-tic-tac-toe-state递归,数学 
3670爬楼梯简单https://leetcode-cn.com/problems/climbing-stairs/动态规划中等
62650只有两个键的键盘中等https://leetcode-cn.com/problems/2-keys-keyboard动态规划 
71673最长递增子序列的个数中等https://leetcode-cn.com/problems/number-of-longest-increasing-subsequence动态规划使用过 
46691贴纸拼词困难https://leetcode-cn.com/problems/stickers-to-spell-word/动态规划,回溯算法 
42215数组中的第K个最大元素中等https://leetcode-cn.com/problems/kth-largest-element-in-an-array堆,分治算法简单,使用过 
311054距离相等的条形码中等https://leetcode-cn.com/problems/distant-barcodes堆,排序 
70973最接近原点的 K 个点中等https://leetcode-cn.com/problems/k-closest-points-to-origin堆,排序,分治算法 
691046最后一块石头的重量简单https://leetcode-cn.com/problems/last-stone-weight/堆,贪心算法简单 
17354俄罗斯套娃信封问题困难https://leetcode-cn.com/problems/russian-doll-envelopes/二分查找,动态规划
11127单词接龙中等https://leetcode-cn.com/problems/word-ladder/广度优先搜索 
15491递增子序列中等https://leetcode-cn.com/problems/increasing-subsequences深度优先搜索 
13200岛屿数量中等https://leetcode-cn.com/problems/number-of-islands深度优先搜索,广度优先搜索,并查集中等,使用过 
58109有序链表转换二叉搜索树中等https://leetcode-cn.com/problems/convert-sorted-list-to-binary-search-tree深度优先搜索,链表 
12695岛屿的最大面积中等https://leetcode-cn.com/problems/max-area-of-island深度优先搜索,数组中等
5398验证二叉搜索树中等https://leetcode-cn.com/problems/validate-binary-search-tree树,深度优先搜索简单
16101对称二叉树简单https://leetcode-cn.com/problems/symmetric-tree/树,深度优先搜索,广度优先搜索简单
61513找树左下角的值中等https://leetcode-cn.com/problems/find-bottom-left-tree-value树,深度优先搜索,广度优先搜索简单,使用过
221043分隔数组以得到最大和中等https://leetcode-cn.com/problems/partition-array-for-maximum-sum 
3715Range 模块困难https://leetcode-cn.com/problems/range-module/线段树,Ordered Map 
47732我的日程安排表 III困难https://leetcode-cn.com/problems/my-calendar-iii/线段树,Ordered Map 
75564寻找最近的回文数困难https://leetcode-cn.com/problems/find-the-closest-palindrome/字符串困难
76102二叉树的层次遍历中等https://leetcode-cn.com/problems/binary-tree-level-order-traversal/树、广度优先搜索简单
7712整数转罗马数字中等https://leetcode-cn.com/problems/integer-to-roman/数组,字符串简单
7836有效的数独中等https://leetcode-cn.com/problems/valid-sudoku/哈希表中等
79845数组中的最长山脉中等https://leetcode-cn.com/problems/longest-mountain-in-array/双指针中等
8015三数之和中等https://leetcode-cn.com/problems/3sum/数组,双指针