上一页 1 2 3 4 5 6 7 8 ··· 64 下一页
摘要: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
posted @ 2019-03-25 19:43 __Meng 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 给定一个数组和滑动窗口的大小,找出所有滑动窗口里数值的最大值。例如,如果输入数组{2,3,4,2,6,2,5,1}及滑动窗口的大小3,那么一共存在6个滑动窗口,他们的最大值分别为{4,4,6,6,6,5}; 针对数组{2,3,4,2,6,2,5,1}的滑动窗口有以下6个: {[2,3,4],2,6, 阅读全文
posted @ 2019-03-23 13:36 __Meng 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1.同步 synchronized 2.轮询 while volatile 3.wait/notify机制 syncrhoized加锁的线程的Object类的wait()/notify()/notifyAll() ReentrantLock类加锁的线程的Condition类的await()/sign 阅读全文
posted @ 2019-03-21 22:47 __Meng 阅读(864) 评论(0) 推荐(0) 编辑
摘要: 输入一个字符串(只包含 a~z 的字符),求其最长不含重复字符的子字符串的长度。例如对于 arabcacfr,最长不含重复字符的子字符串为 acfr,长度为 4。 java: 阅读全文
posted @ 2019-03-21 16:57 __Meng 阅读(591) 评论(0) 推荐(0) 编辑
摘要: 当一个进程申请使用资源的时候,银行家算法通过先 试探 分配给该进程资源,然后通过安全性算法判断分配后的系统是否处于安全状态,若不安全则试探分配作废,让该进程继续等待。 安全序列 安全序列是指对当前申请资源的进程排出一个序列,保证按照这个序列分配资源完成进程。 数据结构 int n,m; //系统中进 阅读全文
posted @ 2019-03-10 14:20 __Meng 阅读(967) 评论(0) 推荐(0) 编辑
摘要: 在一个长度为n的数组里的所有数字都在0到n-1的范围内。 数组中某些数字是重复的,但不知道有几个数字是重复的。也不知道每个数字重复几次。请找出数组中任意一个重复的数字。 例如,如果输入长度为7的数组{2,3,1,0,2,5,3},那么对应的输出是第一个重复的数字2。 java: 阅读全文
posted @ 2019-02-28 23:00 __Meng 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 如何得到一个数据流中的中位数?如果从数据流中读出奇数个数值,那么中位数就是所有数值排序之后位于中间的数值。如果从数据流中读出偶数个数值,那么中位数就是所有数值排序之后中间两个数的平均值。 java: 阅读全文
posted @ 2019-02-28 22:31 __Meng 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
posted @ 2019-01-31 13:16 __Meng 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations. Example: 阅读全文
posted @ 2019-01-30 21:11 __Meng 阅读(177) 评论(0) 推荐(0) 编辑
摘要: There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct 阅读全文
posted @ 2019-01-30 19:44 __Meng 阅读(174) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 64 下一页