11 2020 档案
摘要:Given a set of N people (numbered 1, 2, …, N), we would like to sp...
阅读全文
摘要:You are given a map of a server center, represented as a m * n int...
阅读全文
摘要:There are n cities numbered from 0 to n-1. Given the array edges w...
阅读全文
摘要:这种题目在图里面也不算非常常见 但是一旦见到 这算法就很明显 所以看到这种题目就应该立刻想到最短路径算法 然后需要立刻定位到自己需要...
阅读全文
摘要:这两个算法十分相似: 但是Dijkstra算法用于构建单源点的最短路径树:即从一个图中,找到这样一个树,使得这个树的根节点到任何节点...
阅读全文
摘要:因为这种算法是基于动态规划思想 虽然看上去应该是下面这个样子: dis[i][j] = Math.min(dis[i][j], di...
阅读全文
摘要:refer: https://www.zhihu.com/question/22311234 关于贪心和动态规划的区分 一直没想明白...
阅读全文
摘要:deep copy of a graph. 注意 所谓的deep copy,就是对每一个节点 进行 new Node(node.va...
阅读全文
摘要:就像之前见过的那道:名人不认识任何其他人 但是所有的其他人都认识这个名人。 现在的规则是法官不相信任何人 但是所有其他人都相信这个法...
阅读全文
摘要:经过验证 可以 甚至double也可以 public class Main{ public static void main(Str...
阅读全文
摘要:基本类型能用== 只有基本类型能用这个来比较值 基本类型的包装类 以及其他对象类 用==来比较地址 但是我们一般用不到这个 所以需要...
阅读全文
摘要:given an array of equations and nonequations, check if all the equ...
阅读全文
摘要:这代码功力真的是烂到发指 好好反思一下 990. Satisfiability of Equality Equations Inpu...
阅读全文
摘要:import java.util.* 就已经足够了 因为这个里面包含下面的类: 接口:CollectionComparatorEnu...
阅读全文
摘要:图的题目一直是pain in the ass,虽然总体来说只有两个算法来解决这个问题:DFS和BFS 常用的数据结构有:hashma...
阅读全文
摘要:利用hashset addAll函数 直接添加 public static void main(String[] args) { ...
阅读全文
摘要:207 Course schedule 210 course schedule 2 269 Alien dictionary 329...
阅读全文
摘要:Check whether the original sequence org can be uniquely reconstruc...
阅读全文
摘要:educative.ioblog: uber, airbnb《Design Data Intensive Application》 ...
阅读全文
摘要:首先 系统设计面试考你什么? 考对问题的分析,trade off, 考对一项技术的了解。 怎么样回答才比较好? 最理想的情况:题目给...
阅读全文
摘要:首先,什么是面向对象? 一切事物皆对象,(tips: javascript 中除了两个特殊值undefined 和 null.)...
阅读全文
摘要:Given an integer matrix, find the length of the longest increasing...
阅读全文
摘要:You are given a list of strings words from the dictionary, where w...
阅读全文
摘要:now instead of just checking on whether we can finish all the cour...
阅读全文
摘要:given a 2D array, represents for the class and it’s prerequesite c...
阅读全文
摘要:从每个节点出发 判断从这个节点出发DFS 最后是不是又经过了这个节点(visited) 以LC207 Course Schedule...
阅读全文
摘要:(下面全都是高频题目 要注意) 126 Word Ladder 2 127 word ladder 130 surrounded r...
阅读全文
摘要:提取问题的关键词 根据关键词去对应回答 注意各种反义词 Me-teammates-colleagues-customers-mana...
阅读全文
摘要:classic dp problem 322 You are given coins of different denominati...
阅读全文
摘要:really classic DP: Given two strings word1 and word2, return the m...
阅读全文
摘要:Given a non negative integer number num. For every numbers i in th...
阅读全文
摘要:You have a pointer at index 0 in an array of size arrLen. At each ...
阅读全文
摘要:Given a m * n matrix of ones and zeros, return how many square sub...
阅读全文
摘要:[“E23”, " 2X2", “12S”] given this 2D array, we will start from let...
阅读全文
摘要:递归中我们会 1)明确定义问题与可以被分解的子问题, 2)假设子问题可以被解决,考虑如何把子问题合并解决原问题, 3)明确递归终止/...
阅读全文
摘要:Given an array of integers arr and an integer d. In one step you c...
阅读全文
摘要:Given a 2D binary matrix filled with 0’s and 1’s, find the largest...
阅读全文
摘要:Given a string s. In one step you can insert any character at any ...
阅读全文
摘要:OOP: object-oriented programming is about creating objects that co...
阅读全文
摘要:Java spring is a framework that used to develop java application. ...
阅读全文
摘要:Dear Mr/Ms XXX, I’m Evan on project XXX, department of XXX. Unfort...
阅读全文
摘要:面试中的“软实力” --沟通和小细节点 原则: 全程对已经问过面试官的问题 要记下来 不要问第二遍,就算要问第二遍 也是重复一下自己...
阅读全文
摘要:Given two strings s1, s2, find the lowest ASCII sum of deleted cha...
阅读全文
摘要:Given two words word1 and word2, find the minimum number of steps ...
阅读全文
摘要:classic DP problem, LCS Given two strings text1 and text2, return ...
阅读全文
摘要:we define two words can form a chain: word1 word2, if we can only ...
阅读全文
摘要:given a 2D array and a time T clips[i][0] represents for the start...
阅读全文
摘要:所谓的动态规划 是一种手段 不像树或者图或者Math之类的题目一样 看到题目就知道这个是属于什么题目 应该用什么方式去做。 比如说 ...
阅读全文
摘要:链表反转核心代码: while(cur.next != null){ ListNode temp = cur.nex...
阅读全文
摘要:reference:https://www.1point3acres.com/bbs/thread-689770-1-1.html ...
阅读全文
摘要:Given a string s, return the longest palindromic substring in s. r...
阅读全文
摘要:Given a positive integer n, find the **least number of perfect squ...
阅读全文
摘要:两种方法: Math.round(n) == n //if true, then 是整数 否则不是 n % 1 == 0 //if ...
阅读全文
摘要:931 还是min path sum的问题 这种问题首先想到DP. 首先看一下规则: Given a square array of...
阅读全文
摘要:Given a triangle, find the minimum path sum from top to bottom. Ea...
阅读全文
摘要:another classic DP problem. 2D grid, m*n, each time can only move ...
阅读全文
摘要:Another classic DP problems. Given a non-empty string containing o...
阅读全文
摘要:Given an integer array nums, find the sum of the elements between ...
阅读全文
摘要:198 给定一个数组 找到子序列的和的最大值 但是必须要求这个序列所有的值不能连在一起 很简单 class Solution { ...
阅读全文
摘要:为什么这样行 class Solution { public int rob(int[] nums) { if(...
阅读全文
摘要:从图中可以看出来 BFS 拓扑排序性价比非常高 第二梯队的 是sorting, binary search, binary tre...
阅读全文
摘要:给出一个数组 代表股票价格 1 只允许交易一次 2 允许交易任意多次 3 最多交易两次 4 最多交易k次 5 允许交易任意多次 但是...
阅读全文
摘要:cool down time: at least one day //we use dp, and the following ex...
阅读全文
摘要:最多转k次 求最大利润 毫无思路 不妨来看之前的笔记: 利用二维DP去做 dp[i][j] is defined as maximu...
阅读全文
摘要:最多只能交易两次 求最大可以获得利润 class Solution { public int maxProfit(int[] pr...
阅读全文
摘要:70 You are climbing a staircase. It takes n steps to reach the top...
阅读全文
摘要:经常在做OA/面试遇到下面的情况“ 忘记函数名,忘记main函数怎么写,忘记如何穿参数,忘记如何定义类,总之之前因为做leetCod...
阅读全文
摘要:
阅读全文
摘要:
阅读全文
摘要://利用插入排序的思想对一个链表进行排序class Solution { public ListNode insertionS...
阅读全文
摘要:这是一类很特殊的题目 看到这种题目 不要试图自己去想怎么做 要想一想之前是不是遇到过类似的题目 如果没有的话然后再好好想想技巧以及要...
阅读全文
摘要:class Solution { public ListNode mergeKLists(ListNode[] lists) ...
阅读全文
摘要:class Solution { public ListNode sortList(ListNode head) { ...
阅读全文
摘要:Given a non-negative integer represented as non-empty a singly lin...
阅读全文
摘要:简单的不能再简单了 但是第一次做的时候就是死心眼 认准了只用一个指针 class Solution { public List...
阅读全文
摘要:swap in pairs class Solution { public ListNode swapPairs(ListNo...
阅读全文
摘要:要注意的点: 注意题目说的是binary tree, binary search tree, 还是n-ary tree. 截止到现在...
阅读全文
摘要:follow up of LC116. we used to have a full binary tree but not now...
阅读全文
摘要:You are given a perfect binary tree where all leaves are on the sa...
阅读全文
摘要:Given a binary tree, flatten it to a linked list in-place. althoug...
阅读全文
摘要:Given a binary tree containing digits from 0-9 only, each root-to-...
阅读全文
摘要:我们要记住一个原则 虽然没有用而且造成很多困惑 但是这个是“真理”。 但是在实际写代码的时候 会因此造成很多困惑。 如果传入的是基本...
阅读全文
摘要:Given a non-empty binary tree, find the maximum path sum. For this...
阅读全文
摘要:Given a binary tree and a linkedlist, check if there is a path or ...
阅读全文
摘要:Given a binary tree root, a ZigZag path for a binary tree is defin...
阅读全文
摘要:经典LCA的变形题目 现在不是要求 你找任意给定的两个Node的LCA了 而是找最深leaves的LCA。 回想一下 之前解决这个问...
阅读全文
摘要:suppose the level of root is 1. now we need to return the smallest...
阅读全文
摘要:树的width的定义是: 每一层的最左和最右之间的额所有Node的数量(包括null node) idea: 我们给每一层的节点赋值...
阅读全文
摘要:Given a binary tree, find the leftmost value in the last row of th...
阅读全文
摘要:LCA problem, a really classic one. so you must really understand t...
阅读全文
摘要:LinkedList stack = new LinkedList(); //push and popDeque stack = n...
阅读全文
摘要:still an easy question. cousins are in the same depth but with dif...
阅读全文
摘要:given a tree which each val of the nodes are positive. output the ...
阅读全文
摘要:check if every value on this tree is univalue or not. using recurs...
阅读全文
摘要:The diameter of a binary tree is the length of the longest path be...
阅读全文
摘要:UI设计师/前端工程师 看着两个名词就知道他们之间有什么区别。 UI设计重点在于设计用户界面,即对软件的人机交互,操作逻辑,界面美观...
阅读全文
摘要:the definition of complete binary tree is: all the leaf nodes shou...
阅读全文
摘要:Find the sum of all left leaves in a given binary tree think about...
阅读全文
摘要:平衡树的定义: 任意节点的左右子节点的高度差不超过1. 说到左右子树 就想到递归。 我们要check所有的节点是不是符合这个要求。 ...
阅读全文
摘要:Given a binary tree and a sum, find all root-to-leaf paths where e...
阅读全文
摘要:Given a binary tree and a sum, determine if the tree has a root-to...
阅读全文
摘要:Given a binary tree and a sum, determine if the tree has a root-to...
阅读全文
摘要:Given the root of a binary tree, each node has a value from 0 to 2...
阅读全文
摘要:print all the paths of BT, the out put format should be: [“1->2->5...
阅读全文
摘要:the tree row here means the level order traverse. public List larg...
阅读全文
摘要:just use level traverse and calculate the average of each level. c...
阅读全文
摘要:Given a binary tree, return the bottom-up level order traversal of...
阅读全文
摘要:Given two non-empty binary trees s and t, check whether tree t has...
阅读全文
摘要:using recursion to solve this problem: maxDepth(root) = Math.max(m...
阅读全文
摘要:Given a binary tree, find its minimum depth. The minimum depth is ...
阅读全文
摘要:clearly we can use recursion to solve this problem. and the recurs...
阅读全文
摘要:Checking if a given tree is symmetric tree or not. so all we need ...
阅读全文
摘要:public boolean isSameTree(TreeNode p, TreeNode q) { } this is the ...
阅读全文
摘要:从解面试中的算法题目的方面来说,经常会遇到以下情况: 完全没有思路 连暴力解都不知道从何下手 知道可以用暴力解 但是更优解想不出来 ...
阅读全文
摘要:TreeMap 和 TreeSet 是 Java Collection Framework 的两个重要成员,其中 TreeMap 是...
阅读全文
摘要:it’s the follow up of LC349, which we don’t allows any duplicates ...
阅读全文
摘要:write a function to determine the intersection between those two a...
阅读全文
摘要:Array 转 list List list = Arrays.asList(arr); list转array: String[] ...
阅读全文
摘要:总结一下: print Array需要用Arrays.toString() 但是这只能直接打印一维的。(其他的类型可以采用直接打印或...
阅读全文
摘要:总结一下: 针对遍历 就是用for each或者是迭代器 针对打印:(管他是怎么搞 只要打出来能看懂就行) Hashmap: Sys...
阅读全文
摘要:对于count range sum的题目 首先应该想到的就是 树状数组和线段树就是用来高效解决此类问题的方法。 首先题意就费了一些力...
阅读全文
摘要:An image is represented by a binary matrix with 0 as a white pixel...
阅读全文
摘要:Given an unsorted array of integers, find the length of longest in...
阅读全文
摘要:we have an array with length of n+1, and it contains from 1 to n. ...
阅读全文
摘要:You are a product manager and currently leading a team to develop ...
阅读全文
摘要:this is actually pretty easy, we only needs to do in order travers...
阅读全文
摘要:Given a complete binary tree, count the number of nodes. In a comp...
阅读全文
摘要:given an array and a positive integer s, we have to find the short...
阅读全文
摘要:knight need to save the princess, and he needs to start from left ...
阅读全文
摘要:public int findPeakElement(int[] nums) The array may contain multi...
阅读全文
摘要:Implement int sqrt(int x). this is actually need us to find the bi...
阅读全文
摘要:Implement pow(x, n), which calculates x raised to the power n (i.e...
阅读全文
摘要:divide two integers without using * / and %. the range of integer ...
阅读全文
摘要:Given two sorted arrays nums1 and nums2 of size m and n respective...
阅读全文
摘要:N-ary tree pre/in/post order traversal Construct a tree from (pre/...
阅读全文
摘要:N-ary: N-ary pre/in/post/level order traverse. Clone N-ary Diamete...
阅读全文
摘要:LeetCode 297 Serialize and Deserialize binary tree LeetCode 428 Se...
阅读全文
摘要:use level order like we always do for problems like ser and de-ser...
阅读全文
摘要:serialize is from a Node root to String and deserialize is from St...
阅读全文
摘要:serialize: input TreeNode root and output String like this “1 2 3 ...
阅读全文
摘要:we are given List tree as the input, and we are gonna find the roo...
阅读全文
摘要:LC Maximum Depth binary Tree use BFS count the level we are in. cl...
阅读全文
摘要:idea: the maxDepth of current Node is the maxDepth between its lef...
阅读全文
摘要:Base question: LC543 diameter of binary tree, LC1245 tree diameter...
阅读全文
摘要:Given an undirected tree, return it’s diameter, which is the numbe...
阅读全文
摘要:the defination of diameter of binary tree is the longest path(the ...
阅读全文
摘要:deep copy of a N-ary. we met many problems like this: clone someth...
阅读全文
摘要:Deep copy of a connected undirected graph, and there are some simi...
阅读全文
摘要:Preorder: /*// Definition for a Node.class Node { public int va...
阅读全文
摘要:他是计算机系统内存管理的一种技术。它使得应用程序认为它拥有连续的可用的内存(一个连续完整的地址空间),而实际上,它通常是被分隔成多个...
阅读全文
摘要:also knowns as hamming distance: public class Solution { // you...
阅读全文
摘要:Preorder: 迭代写法: class Solution { public List preorderTraversal(...
阅读全文
摘要:**JDBC是用于在Java语言编程中与数据库连接的API。**有了JDBC提供的库,我们就能连接到数据库 创建SQL语句,在数据库...
阅读全文
摘要:这个跟虚拟内存有关: 分段分页管理是操作系统为了管理好计算机内存资源而出现的。如果没有这个技术的话,那么我们每一次程序运行,都要从内...
阅读全文
摘要:保证稳定性的机制有: 1.校验和 就是说咋数据传输的过程中 将发送的数据段映射为一个整数,然后加起来。发送方在发送数据之间计算校验和...
阅读全文
摘要:我们为什么需要页面置换算法?因为在地址映射过程中 如果发现要访问的页面不在内存中 会产生缺页中断,当发生此现象的时候 如果操作系统内...
阅读全文
摘要:一个应用程序可以有多个进程, 一个进程可以包含多个线程。 两者的区别: 一句话来说就是这两者根本就不是同一层级的概念 所以全部都是区...
阅读全文
摘要:different process requests for the same resource and they both wai...
阅读全文
摘要:节点的删除分为三种情况: 此节点是叶节点 当此节点是叶子节点的时候,如果他是红色的 直接删除即可 如果是黑色的 需要通过左旋右旋进行...
阅读全文
摘要:乐观锁是基于假设每次拿数据的时候别人都不会修改,而悲观锁则正好相反。 所以悲观锁在每次拿数据的时候都会上锁,这样其他线程就拿不到这个...
阅读全文
摘要:这里说的线程之间的通信是指的在同一进程下面。 相对于进程之间的通信 线程之间的通信简单的多。 其通信方式有以下几种: 锁机制:包括互...
阅读全文
摘要:同一主机上的进程通信方式 UNIX进程间通信方式: 包括管道(PIPE), 有名管道(FIFO), 和信号(Signal)Syste...
阅读全文
摘要:They are both used to store information. cookies: they are stored ...
阅读全文
摘要:最大的区别: TCP这个协议保证了在收发数据之前,需要和对方建立可靠的链接(三次握手来实现)而且每次断开连接的时候 需要四次挥手来断...
阅读全文
摘要:堆和栈都是内存的一部分。一个程序在虚拟机运行,会在不同的位置分配内存。 首先:栈内存用于储存局部变量 和进行方法调用。而堆内存用来存...
阅读全文
摘要:利用resize()方法进行扩容,整个扩容过程是需要把旧表每个键进行重哈希然后写入扩容后的新表中。java hashmap默认初始容...
阅读全文
摘要:类的加载过程: 将类的.class文件中的二进制数据读入到内存中->将其放在运行时数据区的方法区内->在堆区创建一个java.lan...
阅读全文
摘要:如何利用TCP协议进行流量控制? 用滑动窗口机制(sliding windows) 这种机制能够让数据传输端的发送窗口不能超过接收端...
阅读全文
摘要:第一种:慢开始(slow-start)和拥塞避免(congestion avoidance) 慢开始算法就是从小到大逐渐增加发送窗口...
阅读全文
摘要:1.将对象(对象的引用)作为参数传递时传递的是引用(相当于指针)。也就是说函数内对参数所做的修改会影响原来的对象。 2.当将基本类型...
阅读全文
摘要:指针就是对象在内存中的地址 而引用是对象的别名,其本质上是一个功能受限但是安全性更高的指针. 两者的区别在于:引用访问变量的话是直接...
阅读全文
摘要:父类中静态成员变量和静态代码块 2. 子类中静态成员变量和静态代码块 3. 父类中普通成员变量和代码块,父类的构造函数 4. 子类中...
阅读全文

浙公网安备 33010602011771号