- 博客(17)
- 收藏
- 关注
原创 leetcode刷题_OJ 127
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 at a ti...
2018-07-31 17:01:37 207
原创 13.HashMap的实现过程
参考博客:https://www.cnblogs.com/holyshengjie/p/6500463.htmlhttps://www.cnblogs.com/chengxiao/p/6059914.htmlhttps://blog.csdn.net/sinat_33536912/article/details/523503751. HashMap的数据结构数据结构中有数组和链...
2018-07-31 15:10:12 146
转载 ==与equals的区别
【转】java中的数据类型,可分为两类:1.基本数据类型,也称原始数据类型。byte,short,char,int,long,float,double,boolean,他们之间的比较,应用双等号(==),比较的是他们的值。2.复合数据类型(类) 当他们用(==)进行比较的时候,比较的是他们在内存中的存放地址,所以,除非是同一个new出来的对象,他们的比较后的结果为true,否则比...
2018-07-31 14:50:10 69
原创 leetcode刷题_OJ 125
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Note: For the purpose of this problem, we define empty string as valid palindrome.Examp...
2018-07-30 14:59:37 135
原创 leetcode刷题_OJ 98
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.The r...
2018-07-27 16:35:19 160
原创 leetcode刷题_OJ 88
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and n respectively.You may assume that...
2018-07-27 10:53:59 326
原创 leetcode刷题_OJ 73
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.Example 1:Input: [ [1,1,1], [1,0,1], [1,1,1]]Output: [ [1,0,1], [0,0,0], [1,0,1]]Exam...
2018-07-26 14:21:08 134
原创 leetcode刷题_OJ 70
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive...
2018-07-25 15:16:29 215
原创 leetcode刷题_OJ 57
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Examp...
2018-07-24 11:35:26 92
原创 leetcode刷题_OJ 56
Given a collection of intervals, merge all overlapping intervals.Example 1:Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since intervals [1,3] and [2,6] overlaps,...
2018-07-23 17:22:47 113
原创 leetcode刷题_OJ 28
Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Example...
2018-07-20 14:07:03 154
原创 leetcode刷题_OJ 21
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1-...
2018-07-20 11:57:22 129
转载 Handler的机制描述以及过程详解11&26
Handler更新UI的方法主要有4种,我用过的是handler+runnable。主要涉及3个对象:Handler,Looper,MessageQueue大致的工作过程可以总结为:发送:handler负责发送消息,looper接收来自handler的消息并创建looper实例,looper将消息放到消息队列(message queue)中;接收:looper通过不断从消息队列中获...
2018-07-19 15:37:20 153
原创 leetcode刷题_OJ 20
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of b...
2018-07-19 13:57:11 134
原创 7.如何避免OOM异常
1)什么是OOM? OOM,全称“Out Of Memory”,翻译成中文就是“内存用完了”,来源于java.lang.OutOfMemoryError。 2)为什么会OOM?为什么会没有内存了呢?原因不外乎有两点:1)分配的少了:比如虚拟机本身可使用的内存(一般通过启动时的VM参数指定)太少。2)应用用的太多,并且用完没释放,浪费了。此时就会造成内存泄露或者内存溢出。内存...
2018-07-18 16:43:59 1581
原创 leetcode刷题_OJ 15
Leet Code OJ 15. 3Sum [Difficulty: Medium] 这题难的地方在于:1.用什么存储结果:vector2.怎么排除重复结果:先进行预处理:排序,排序后的结果对于比较重复元素以及结果大于或者小于0都有很大帮助class Solution {public: vector<vector<int>> threeSum(v...
2018-07-18 15:48:59 111
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人