- 博客(26)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode_Isomorphic Strings
Isomorphic StringsGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be
2015-04-30 01:07:05 356
LeetCode_Isomorphic Strings
Isomorphic StringsGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must ...
2015-04-30 01:07:00 103
原创 Java四种引用
1.强引用(Strong Reference);2.软引用(Soft Reference);3.弱引用(Weak Reference);4.虚引用(Phantom Reference).
2015-04-29 02:17:59 331
Java四种引用
JDK1.2之前,Java中引用(reference)的定义:如果reference类型的数据中存储的数值代表的是另外一块内存的起始地址,那么这块内存就是一个引用。这样的概念不足以应对这样的情况:对于一些可有可无的对象,当内存空间足够时,则将对象保存在内存中,不回收;如果内存在垃圾回收后还是不足,就可以回收这这些对象。JDK1.2之后的版本对引用做了扩充:将引用分为四类:1.强引用(Stron...
2015-04-29 02:17:00 65
原创 LeetCode_Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine i
2015-04-28 01:09:05 303
LeetCode_Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine i...
2015-04-28 01:09:00 60
原创 java native method
最近在看《深入理解Java虚拟机》,看了没几页,看到了一个以前不了解的概念:native方法。学习如下:"A native method is a Java method whose implementation is provided by non-java code." native方法即本地方法,native方法的实现是非Java的,例如这个方法是用C/C++实现的。在Java文件中一个
2015-04-27 01:39:33 3332
java native method
最近在看《深入理解Java虚拟机》,看了没几页,看到了一个以前不了解的概念:native方法。学习如下:"A native method is a Java method whose implementation is provided by non-java code." native方法即本地方法,native方法的实现是非Java的,例如这个方法是用C/C++实现的。在Java文件中一个...
2015-04-27 01:39:00 181
原创 LeetCode_Search in Rotated Sorted Array
题目:Suppose a sorted array 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 the array return
2015-04-20 00:50:15 306
LeetCode_Search in Rotated Sorted Array
题目:Suppose a sorted array 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 the array return...
2015-04-20 00:50:00 60
原创 LeetCode_Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.
2015-04-20 00:37:28 323
LeetCode_Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array....
2015-04-20 00:37:00 66
原创 LeetCode_Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, where
2015-04-17 01:50:25 662
LeetCode_Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, where...
2015-04-17 01:50:00 60
原创 LeetCode_Merge Two Sorted Lists
问题: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.将两个有序链表合为一个有序的链表并返回头指针。/** * Definition for singly-
2015-04-17 01:46:04 624
LeetCode_Merge Two Sorted Lists
问题: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.将两个有序链表合为一个有序的链表并返回头指针。/** * Definition for singly...
2015-04-17 01:46:00 54
原创 LeetCode_Pascal's Triangle
https://leetcode.com/problems/pascals-triangle/Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1],
2015-04-16 02:26:01 316
LeetCode_Pascal's Triangle
https://leetcode.com/problems/pascals-triangle/GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,...
2015-04-16 02:26:00 74
原创 LeetCode_Insertion Sort List
题目:Sort a linked list using insertion sort,即仿照插入排序(直接插入排序)对一个链表排序。插入排序的思想:总共进行n-1趟排序,在排列第i个元素时,前面的i个元素是有序的,将第i个元素插入到前i个元素中,并且保证被插入的数组是有序的,数组是顺序存储的,因此向有序的数组插入一个元素时,需要从插入位置之后的各个元素后移。这就是插入排序的思想。插入排序的时间
2015-04-14 23:54:40 600
LeetCode_Insertion Sort List
题目:Sort a linked list using insertion sort,即仿照插入排序(直接插入排序)对一个链表排序。插入排序的思想:总共进行n-1趟排序,在排列第i个元素时,前面的i个元素是有序的,将第i个元素插入到前i个元素中,并且保证被插入的数组是有序的,数组是顺序存储的,因此向有序的数组插入一个元素时,需要从插入位置之后的各个元素后移。这就是插入排序的思想。插入排序的时间...
2015-04-14 23:54:00 63
原创 LeetCode_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. Yo
2015-04-14 23:39:47 608
LeetCode_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 onl...
2015-04-14 23:39:00 56
原创 复杂声明解析
C语言的指针很久没看了,复习一下,做一下总结。C语言的复杂声明,例如:void (*f(int,int (*)(int)))();怎么样,是不是很复杂?看着摸不到头脑,不知从何说起。看了挺多资料,主要是应用“右左法则”,现总结如下:1.基本的C语言声明:①int a;//声明一个整形数a②int *a;//声明一个指针,该指针指向一个整形数③int **a;//声明了一个指针,该指
2015-04-13 23:40:14 612
复杂声明解析
C语言的指针很久没看了,复习一下,做一下总结。C语言的复杂声明,例如:void (*f(int,int (*)(int)))();怎么样,是不是很复杂?看着摸不到头脑,不知从何说起。看了挺多资料,主要是应用“右左法则”,现总结如下:1.基本的C语言声明:①int a;//声明一个整形数a②int *a;//声明一个指针,该指针指向一个整形数③int **a;//声明了一个指针,该指...
2015-04-13 23:40:00 57
原创 LeetCode题目_Reverse Integer
最近在LeetCode上做题,写点东西记录一下,虽然自己做的都是些很水的题目,但是重在练手。题号7:Reverse Integer,题目描述:Reverse digits of an integer:例如,输入123,输出321;输入-123,输出-321。思路很简单:将原数的每一位求出,然后将原数的每一位倒序,生成一个整数。在程序中,使用了队列,利用其先进先出的原则,倒序原数每一位。
2015-04-12 00:15:58 410
LeetCode题目_Reverse Integer
最近在LeetCode上做题,写点东西记录一下,虽然自己做的都是些很水的题目,但是重在练手。题号7:Reverse Integer,题目描述:Reverse digits of an integer:例如,输入123,输出321;输入-123,输出-321。思路很简单:将原数的每一位求出,然后将原数的每一位倒序,生成一个整数。在程序中,使用了队列,利用其先进先出的原则,倒序原数每一位。...
2015-04-12 00:15:00 56
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人