- 博客(140)
- 资源 (2)
- 收藏
- 关注
原创 886. Possible Bipartition
Given a set of N people (numbered 1, 2, ..., N), we would like to split everyone into two groups of any size.Each person may dislike some other people, and they should not go into the same group. ...
2018-10-20 10:51:18
362
原创 539. Minimum Time Difference
Given a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minutes difference between any two time points in the list.Example 1:Input: ["23:59","00:00"]Output: 1Note...
2018-10-07 17:20:01
223
原创 394. Decode String
Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is gua...
2018-09-28 21:54:36
240
原创 635. Design Log Storage System
You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour:Minute:Second, for example, 2017:01:01:23:59:59. A...
2018-09-08 09:18:18
302
原创 681. Next Closest Time
Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused.You may assume the given input str...
2018-08-18 21:23:38
183
原创 128. Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Example:Input: [100, 4, 200, 1, 3, 2]Output: 4Ex...
2018-07-27 08:36:02
183
原创 《人人都是产品经理》读书笔记
今天开始看很多人推荐的《人人都是产品经理》。感觉扉页上的题记很有道理:『不是每个人都能以产品经理为业,但在我看来,产品经理是一类人,他们的做事思路与方法可以解决很多实际的生活问题。』也正如学编程一样,它能给你带来一种新的思路,让你从另一个不同的角度看待问题,从而帮助你更好地解决问题。产品经理身上有很多值得学习的地方,比如,对于一个产品,有一种主人翁的态度,知道这个产品是给谁用的,怎样用...
2018-07-22 22:38:05
2483
原创 大数据书单
之前一直忙着换工作的事,才发现已经一个月没写东西了。入职新公司,开始做数据方面的工作。看了一下公司wiki,感觉要学的东西还挺多。从之前的经验来看,看书比从网上搜博客看来的靠谱。一方面是质量有保证,很少有错误,另一方面是会学的比较系统。于是从网上搜了一下书单,感觉挺乱的。知乎上推荐的大多是paper,以及英文原版书籍,看起来会比较麻烦;豆瓣上好像还行,但是不能按照评分排序,比较蛋疼。最后加上京东评...
2018-06-30 23:21:05
947
原创 567. Permutation in String
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string.Example ...
2018-05-30 09:12:02
246
原创 《深入理解Java虚拟机》读书笔记
年轻代结构当Eden区满时,还存活的对象将被复制到Survivor区(两个中的一个),当这个Survivor区满时,此区的存活对象将被复制到另外一个Survivor区,当这个Survivor区也满了的时候,从第一个Survivor区复制过来的并且此时还存活的对象,将被复制“年老区(Tenured)”。需要注意,Survivor的两个区是对称的,没先后关系,所以同一个区中可能同时存在从Eden复制过...
2018-05-17 10:48:31
249
原创 《Spring揭秘》读书笔记
看第二遍,发现有些东西都忘了,而且还是有些新收获。按照bean的生命周期的顺序,总结一下相关的东西。图片来源-spring揭秘1.BeanFactory是基础IOC容器,ApplicationContext在BeanFactory的基础上构建,是相对比较高级的容器实现,除了拥有BeanFactory的所有支持,ApplicationContext还提供了其他高级特性,比如事件发布、国际化信息支持等...
2018-05-02 08:36:35
635
原创 《MyBatis从入门到精通》读书笔记
书只有300页,2天就快看完了。第二遍看,还是会发现一些之前没有注意到的点,总结一下。1.之前只知道spring aop中用到了动态代理,实际上mybatis中也有用到。mapper接口没有实现类却能正常调用,就是使用的动态代理。当调用一个接口的方法时,会先通过接口的全限定名称和当前调用的方法名的组合得到一个方法 id,这个 id 的值就是映射 XML 中namespace 和具体方法 id 的组...
2018-05-01 09:32:26
513
原创 《redis设计与实现》读书笔记
sds (simple dynamic string)比起 C 字符串, SDS 具有以下优点:len属性维护字符串长度,常数复杂度即可获取。预先检查长度是否满足需求,如果不满足自动拓展,杜绝缓冲区溢出。空间预分配、惰性空间释放会减少修改字符串长度时所需的内存重分配次数。二进制安全。兼容部分 C 字符串函数。list链表被广泛用于实现 Redis 的各种功能, 比如列表键, 发布与订阅, 慢查询,...
2018-04-30 08:35:47
199
原创 java nio总结
标准的IO基于字节流和字符流进行操作的,而NIO是基于通道(Channel)和缓冲区(Buffer)进行操作,数据总是从通道读取到缓冲区中,或者从缓冲区写入到通道中。Java NIO可以让你非阻塞的使用IO,例如:当线程从通道读取数据到缓冲区时,线程还是可以进行其他事情。当数据被写入到缓冲区时,线程可以继续处理它。从缓冲区写入通道也类似。Java NIO引入了选择器的概念,选择器用于监听多个通道的...
2018-04-29 08:48:53
187
原创 java io总结
java io框架中常见类File如果你需要跳跃式地读取文件其中的某些部分,可以使用RandomAccessFile。random随机访问文件原理: 首先把随机访问的文件对象看作存储在文件系统中的一个大型 byte 数组,然后通过指向该 byte 数组的光标或索引(即:文件指针 FilePointer)在该数组任意位置读取或写入任意数据。PipedInputStream、PipedOu...
2018-04-28 08:37:08
145
原创 jvm调优-收集器的选择
Serial、Serial Old正如名字一样,是串行的收集器,分别对应新生代和老年代的收集器。会『stop the world』。用于单CPU机器,避免线程交互的开销;或者client模式下的虚拟机。ParNew用于新生代,是serial的多线程版本,与serial共用了大量代码。可以与CMS配合使用。Parallel Scavenge用于新生代,采用复制算法。目的是达到一个可控...
2018-04-26 23:27:57
228
原创 243. Shortest Word Distance
Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list.For example,Assume that words = ["practice", "makes", "perfect", "coding", "makes"...
2018-03-31 21:08:29
160
原创 266. Palindrome Permutation
Given a string, determine if a permutation of the string could form a palindrome.For example,"code" -> False, "aab" -> True, "carerac" -> True.判断一个字符串的字母排列之后是否能组成回文字符串很快就做出来了 思路是回文字符串中的字符都是成对...
2018-03-30 08:59:34
177
原创 273. Integer to English Words
Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1.For example,123 -> "One Hundred Twenty Three"12345 -> "Twelve Thousand Three...
2018-03-28 09:16:38
227
原创 654. Maximum Binary Tree
Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array.The left subtree is the maximum tree constructed from ...
2018-03-22 22:23:46
149
原创 333. Largest BST Subtree
Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes in it.Note:A subtree must include all of its descendants.Her...
2018-02-27 08:37:58
250
原创 56. Merge Intervals
Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].合并数组写的和答案差不多 但是答案中的排序 用到java8特性 比较简洁 public List<Interval&g...
2018-02-25 22:02:28
136
原创 162. Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in that cas...
2018-02-20 08:19:02
165
原创 94. Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].Note: Recursive solution is trivial, could you ...
2018-02-19 13:49:51
133
原创 155. Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get
2018-01-28 09:51:19
144
原创 165. Compare Version Numbers
Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty
2018-01-16 22:51:27
142
原创 46. Permutations
Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3
2018-01-15 23:21:05
257
原创 285. Inorder Successor in BST
Given a binary search tree and a node in it, find the in-order successor of that node in the BST.Note: If the given node has no in-order successor in the tree, return null.做出来了 但是需要遍历整棵树 下面的基于
2018-01-13 21:53:05
222
原创 173. Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next()
2018-01-11 22:06:45
168
原创 215. Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return
2018-01-10 09:04:10
170
原创 26. Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by modifying
2018-01-09 07:56:09
173
原创 102. Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7], 3 / \
2018-01-07 22:55:43
162
原创 24. Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y
2018-01-05 09:44:21
163
原创 33. Search in Rotated Sorted Array
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).You are given a target value to search. If found in
2018-01-03 09:04:10
122
原创 8. String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input
2018-01-02 09:08:36
132
原创 13. Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.discuss中vote最高public int romanToInt(String s) { int nums[]=new int[s.l
2017-12-31 20:40:11
183
原创 101. Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2/ \ / \3 4 4 3But the follo
2017-12-30 22:49:21
131
原创 238. Product of Array Except Self
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and
2017-12-29 15:13:07
117
原创 127. Word Ladder
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:Only one letter can be changed a
2017-12-24 22:30:48
130
原创 116. Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right nod
2017-12-22 23:18:16
135
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人