- 博客(27)
- 资源 (5)
- 收藏
- 关注
原创 LeetCode-remove-nth-node-from-end-of-list
题目描述Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node f
2016-08-30 20:54:50 338
原创 LeetCode-validate-binary-search-tree
题目描述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 t
2016-08-30 20:27:15 375
原创 LeetCode-remove-element
题目描述Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the
2016-08-30 19:40:51 203
转载 Android开发中常见的5大内存泄漏问题及解决办法
本文转自:http://www.maiziedu.com/article/9126/这篇文章我在网络上看到的为数不多的介绍内存泄漏的好文章,怒转。 在android开发中,内存泄漏是比较常见的问题,有过一些android编程经历的童鞋应该都遇到过,但为什么会出现内存泄漏呢?内存泄漏又有什么影响呢?在android程序开发中,当一个对象已经不需要再使用了,本该被回收时,而另外
2016-08-30 10:35:10 340
原创 华为OJ-判断两个IP是否在同一子网
题目描述子网掩码是用来判断任意两台计算机的IP地址是否属于同一子网络的根据。子网掩码与IP地址结构相同,是32位二进制数,其中网络号部分全为“1”和主机号部分全为“0”。利用子网掩码可以判断两台主机是否中同一子网中。若两台主机的IP地址分别与它们的子网掩码相“与”后的结果相同,则说明这两台主机在同一子网中。示例:I P 地址 192.168.0.1子网掩码 25
2016-08-28 13:50:28 1088
转载 Java-观察者模式
本文转载自:http://blog.csdn.net/jason0539/article/details/45055233观察者模式中,一个被观察者管理所有相依于它的观察者物件,并且在本身的状态改变时主动发出通知。这通常通过呼叫各观察者所提供的方法来实现。此种模式通常被用来实现事件处理系统。角色抽象被观察者角色:把所有对观察者对象的引用保存在一个集合
2016-08-25 22:31:08 345
转载 Java中四种引用类型介绍
本文转自:http://www.cnblogs.com/linghu-java/p/5691804.html在java中有四种引用类型需要了解:⑴强引用(StrongReference)强引用是使用最普遍的引用。如果一个对象具有强引用,那垃圾回收器绝不会回收它。当内存空间不足,Java虚拟机宁愿抛出OutOfMemoryError错误,使程序异常终止,也不会靠随意回收具有强引用
2016-08-25 21:47:25 258
转载 Java模式-适配器模式
转载自:http://blog.csdn.net/elegant_shadow/article/details/5006175这篇文章简明易懂,没有错误,把深奥的问题用简单的例子全讲清楚了,赞一个!首先,先来先讲讲适配器。适配就是由“源”到“目标”的适配,而当中链接两者的关系就是适配器。它负责把“源”过度到“目标”。举个简单的例子,比如有一个“源”是一个对象人,他拥有2种技能分别是
2016-08-25 21:41:56 249
转载 android onSaveInstance方法
文章转自:http://blog.csdn.net/chenmeng911/article/details/50439727为什么需要用到Activity状态保存, 如何用 ?1)我们希望当前的Activity中的信息不会因为Activity状态的改变,而丢失。比如横竖屏的切换,突然来了个电话。2)借助Activity Lifecycle + Preference来完成状态保存
2016-08-22 15:27:26 864
原创 Android-Notification 简单介绍
public class MainActivity extends AppCompatActivity { private NotificationManager mNotificationManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCre
2016-08-22 14:48:08 218
原创 快速排序-java
一口气整理一下各种排序算法,以后面试要是死在这上面,干脆回家种地吧!!!public class Main{ public static void quickSort(int[] A){ sort(A, 0, A.length-1); } public static void sort(int[] A, int left, int right) { if(lef
2016-08-19 22:45:30 286
原创 归并排序-java
今天研究了一下归并排序,原理是这样的:将两个(或两个以上)有序表合并成一个新的有序表,即把待排序序列分为若干个子序列,每个子序列是有序的。然后再把有序子序列合并为整体有序序列综合并运用递归和归并的方法:代码是这样的:/** * 归并排序 */package algorithm;public class Test { public static void mai
2016-08-19 22:28:57 163
原创 堆排序-java
今天某易打击,堆排序直接干懵了,下定决心好好学一下。public class HeapSort { public static void HeapSort(int[] A, int size) { BuildHeap(A, size); for(int i = size-1; i>=0; i--) { int temp = A[0]; A[0] = A[i];
2016-08-19 22:23:43 616
原创 LeetCode-convert-sorted-list-to-binary-search-tree
题目描述Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.把一个有序链表转化为平衡二叉树。思路:利用快慢指针找到中间节点,这也就是根节点,然后递归调用生成平衡二叉树函数
2016-08-14 18:33:14 275
原创 Leetcode-rotate-list
题目描述Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given1->2->3->4->5->NULLand k =2,return4->5->1->2->3->NULL.我的想法是找到要倒置的第一个元素位置,然后
2016-08-14 16:39:02 186
原创 Leetcode-partition-list
题目描述Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the
2016-08-14 15:00:43 504
原创 Leetcode-remove-duplicates-from-sorted-list-ii
题目描述Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given1->2->3->3->4->4->5, return1->2->5
2016-08-14 12:44:03 247
原创 Leetcode-binary-tree-zigzag-level-order-traversal
题目描述Given a binary tree, return the zigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:
2016-08-11 22:16:52 243
原创 Leetcode-pascals-triangle
题目描述Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]杨辉三角问题,我的
2016-08-11 21:09:14 230
原创 Leetcode-combinations
回溯!!!题目描述Given two integers n and k, return all possible combinations ofk numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3],
2016-08-11 20:46:34 195
原创 Leetcode-plus-one
题目描述Given a number represented as an array of digits, plus one to the number.一个数看做一个数组,对这个数加1,求结果数组。我的方法貌似有点蠢。public class Solution { public int[] plusOne
2016-08-05 09:46:06 216
原创 Leetcode-remove-duplicates-from-sorted-array-ii
题目描述Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should return length =5, and A
2016-08-05 09:12:25 195
原创 LeetCode-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,#,#,15,7}, 3 / \
2016-08-03 10:01:07 291
原创 Leetcode-3sum
题目描述Given an array S of n integers, are there elements a, b, c in such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a trip
2016-08-03 09:43:24 136
原创 Leetcode-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 th
2016-08-02 16:19:31 164
原创 Leetcode-valid-palindrome
题目描述Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama"is a palindrome."race a
2016-08-02 15:46:18 166
原创 Leetcode-path-sum-ii
题目描述Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum = 22, 5
2016-08-02 15:27:42 192
Android 暗黑模式,dark mode,demo源码
2020-04-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人