摘要:
java集合类主要由两个接口派生而出:Collection和Map,请注意,Map没有继承Collection接口. Set集合。 Set集合里面的多个对象没有明显顺序。Set不允许有重复元素。当试图把两个相同的对象()加入一个Set中时,对象会调用equals方法比较两个对象元素是否相同,... 阅读全文
摘要:
Isomorphic Strings Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced ... 阅读全文
摘要:
JDK1.2之前,Java中引用(reference)的定义:如果reference类型的数据中存储的数值代表的是另外一块内存的起始地址,那么这块内存就是一个引用。这样的概念不足以应对这样的情况:对于一些可有可无的对象,当内存空间足够时,则将对象保存在内存中,不回收;如果内存在垃圾回收后还是不足... 阅读全文
摘要:
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 ma... 阅读全文
摘要:
最近在看《深入理解Java虚拟机》,看了没几页,看到了一个以前不了解的概念:native方法。学习如下: "A native method is a Java method whose implementation is provided by non-java code." native方法即... 阅读全文
摘要:
题目: 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 tar... 阅读全文
摘要:
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 ... 阅读全文
摘要:
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... 阅读全文
摘要:
问题: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. 将两个... 阅读全文
摘要:
https://leetcode.com/problems/pascals-triangle/ Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, ... 阅读全文