随笔分类 -  面试

面试知识点汇集
137. Single Number II
摘要:Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your al 阅读全文

posted @ 2020-09-19 16:05 wsw_seu 阅读(85) 评论(0) 推荐(0)

redis分布式锁
摘要:一、分布式锁的实现有哪些? 基本要求 实现一个分布式锁定, 我们至少要考虑它能满足一下的这些需求: 互斥, 就是要在任何的时刻, 同一个锁只能够有一个客户端用户锁定. 不会死锁, 就算持有锁的客户端在持有期间崩溃了, 但是也不会影响后续的客户端加锁 谁加锁谁解锁, 很好理解, 加锁和解锁的必须是同一 阅读全文

posted @ 2020-09-17 20:01 wsw_seu 阅读(210) 评论(0) 推荐(0)

Golang调度器GMP原理与调度全分析(转 侵 删)
摘要:该文章主要详细具体的介绍Goroutine调度器过程及原理,包括如下几个章节。 第一章 Golang调度器的由来 第二章 Goroutine调度器的GMP模型及设计思想 第三章 Goroutine调度场景过程全图文解析 一、Golang“调度器”的由来? (1) 单进程时代不需要调度器 我们知道,一 阅读全文

posted @ 2020-09-16 20:33 wsw_seu 阅读(314) 评论(0) 推荐(0)

Single Number III
摘要:Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements tha 阅读全文

posted @ 2020-09-15 22:18 wsw_seu 阅读(77) 评论(0) 推荐(0)

innodb中的锁
摘要:一、锁的对象 InnoDb的行级锁是基于索引实现的,即枷锁的对象是索引而非具体数据。当加操作使用聚集索引时 ,Innodb会锁住聚集索引;而使用非聚集索引时,innodb会先锁住非主键索引,再锁定非聚集索引锁对应的聚集索引。 行级锁的加锁条件必须有对应的索引项,否则会退化为表级锁。 二、共享锁 共享 阅读全文

posted @ 2020-09-15 20:12 wsw_seu 阅读(322) 评论(1) 推荐(0)

41. First Missing Positive
摘要:Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4,-1,1] Output: 阅读全文

posted @ 2020-09-13 16:31 wsw_seu 阅读(75) 评论(0) 推荐(0)

268. Missing Number
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Input: [3,0,1] Output 阅读全文

posted @ 2020-09-13 14:47 wsw_seu 阅读(130) 评论(0) 推荐(0)

154. Find Minimum in Rotated Sorted Array II(循环数组查找)
摘要:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). F 阅读全文

posted @ 2020-09-13 14:01 wsw_seu 阅读(104) 评论(0) 推荐(0)

局部最小值(二分)
摘要:局部最小存在的几种情况,1. 长度为1,arr[0]就是局部最小;2. 数组的开头,如果arr[0] < arr[1] ,arr[0]被定义为局部最小。 3. 数组的结尾,如果arr[N-1] < arr[N-2] ,arr[N-1]被定义为局部最小。 所以剩下就是数组下标1~N-2之间的了。再按a 阅读全文

posted @ 2020-09-13 12:13 wsw_seu 阅读(1152) 评论(0) 推荐(0)

92. Reverse Linked List II 翻转链表II
摘要:Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Out 阅读全文

posted @ 2020-09-13 11:00 wsw_seu 阅读(83) 评论(0) 推荐(0)

leetcode Reverse Nodes in k-Group翻转链表K个一组
摘要:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to 阅读全文

posted @ 2020-09-13 10:44 wsw_seu 阅读(169) 评论(0) 推荐(0)

动态规划题解(转)
摘要:动态规划算法似乎是一种很高深莫测的算法,你会在一些面试或算法书籍的高级技巧部分看到相关内容,什么状态转移方程,重叠子问题,最优子结构等高大上的词汇也可能让你望而却步。 而且,当你去看用动态规划解决某个问题的代码时,你会觉得这样解决问题竟然如此巧妙,但却难以理解,你可能惊讶于人家是怎么想到这种解法的。 阅读全文

posted @ 2020-07-26 18:16 wsw_seu 阅读(334) 评论(0) 推荐(0)

leetcode 30day--2
摘要:202. Happy Number Write an algorithm to determine if a number n is "happy". A happy number is a number defined by the following process: Starting with 阅读全文

posted @ 2020-07-22 21:17 wsw_seu 阅读(123) 评论(0) 推荐(0)

leetcode 30day--1
摘要:Single Number Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have 阅读全文

posted @ 2020-07-22 21:00 wsw_seu 阅读(150) 评论(0) 推荐(0)

525. Contiguous Array
摘要:Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Input: [0,1] Output: 2 Explanation: [0 阅读全文

posted @ 2020-07-22 20:50 wsw_seu 阅读(164) 评论(0) 推荐(0)

链表常见问题
摘要:链表的存储方式使得它可以高效的在指定位置插入与删除,时间复杂度均为 O(1)。 在结点 p 之后增加一个结点 q 总共分三步: 申请一段内存用以存储 q (可以使用内存池避免频繁申请和销毁内存)。将 p 的指针域数据复制到 q 的指针域。更新 p 的指针域为 q 的地址。 删除结点 p 之后的结点 阅读全文

posted @ 2020-07-21 22:33 wsw_seu 阅读(328) 评论(0) 推荐(0)

449. 序列化和反序列化二叉搜索树
摘要:序列化是将数据结构或对象转换为一系列位的过程,以便它可以存储在文件或内存缓冲区中,或通过网络连接链路传输,以便稍后在同一个或另一个计算机环境中重建。 设计一个算法来序列化和反序列化二叉搜索树。 对序列化/反序列化算法的工作方式没有限制。 您只需确保二叉搜索树可以序列化为字符串,并且可以将该字符串反序 阅读全文

posted @ 2020-07-19 17:20 wsw_seu 阅读(319) 评论(0) 推荐(0)

mysql一些好的问题
摘要:一、“N叉树”的N值在MySQL中是可以被人工调整吗? 1, 通过改变key值来调整N叉树中非叶子节点存放的是索引信息,索引包含Key和Point指针。Point指针固定为6个字节,假如Key为10个字节,那么单个索引就是16个字节。如果B+树中页大小为16K,那么一个页就可以存储1024个索引,此 阅读全文

posted @ 2020-07-13 15:47 wsw_seu 阅读(770) 评论(0) 推荐(0)

goroutine背后的系统知识
摘要:1. 操作系统与运行库 2. 并发与并行 (Concurrency and Parallelism)3. 线程的调度4. 并发编程框架5. goroutine 1. 操作系统与运行库 对于普通的电脑用户来说,能理解应用程序是运行在操作系统之上就足够了,可对于开发者,我们还需要了解我们写的程序是如何在 阅读全文

posted @ 2020-06-04 19:08 wsw_seu 阅读(302) 评论(0) 推荐(0)

tcp流量控制与拥塞控制
摘要:一:流量控制 什么是流量控制?流量控制的目的? 如果发送者发送数据过快,接收者来不及接收,那么就会有分组丢失。为了避免分组丢失,控制发送者的发送速度,使得接收者来得及接收,这就是流量控制。流量控制根本目的是防止分组丢失,它是构成TCP可靠性的一方面。 如何实现流量控制? 由滑动窗口协议(连续ARQ协 阅读全文

posted @ 2020-06-03 22:38 wsw_seu 阅读(445) 评论(0) 推荐(0)

导航