题目如下: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each ...
分类:
其他好文 时间:
2016-08-16 23:43:31
阅读次数:
178
java.util.Arrays类能方便地操作数组,它提供的所有方法都是静态的。具有以下功能: ² 给数组赋值:通过fill方法。 ² 对数组排序:通过sort方法,按升序。 ² 比较数组:通过equals方法比较数组中元素值是否相等。 ² 查找数组元素:通过binarySearch方法能对排序好的 ...
分类:
编程语言 时间:
2016-08-16 14:32:26
阅读次数:
171
arraycopy是个本地方法,无返回值。 copyOf()底层调用arraycopy,不过可以直接返回一个数组,代码更加简短,只是自定义数组长度的能力更差了。 ...
分类:
编程语言 时间:
2016-08-16 01:52:40
阅读次数:
627
java集合框架是java提供的工具包,在java.util.*中,这个包中包含了常用的数据结构:集合、数组、链表、栈、队列、映射等。java集合框架主要可以分为四个部分:List列表、Set集合、Map映射和工具类(Iterator迭代器、Enumeration枚举类、Arrays和Collect ...
分类:
编程语言 时间:
2016-08-15 20:45:58
阅读次数:
147
1、数组是一组变量集合,用来存储相同数据类型的一组数据的连续的空间。 *数组名(标识符)连续空间首地址。 *元素下标标明元素在数组中的位置,从0开始。 *每个元素都可以通过下标来访问。 *数组长度固定不变,要避免数组越界。 2、数组的使用 *声明数组 数据类型 [] 数组名; *分配空间 数组名 = ...
分类:
编程语言 时间:
2016-08-14 20:48:13
阅读次数:
131
[题目] Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. [题目解析] 这是一个很简单的 ...
分类:
其他好文 时间:
2016-08-14 19:26:16
阅读次数:
135
4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The ...
分类:
其他好文 时间:
2016-08-14 14:16:51
阅读次数:
120
https://leetcode.com/problems/median-of-two-sorted-arrays/ There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median o ...
分类:
其他好文 时间:
2016-08-13 21:09:11
阅读次数:
101
1.泛型和类型安全的容器 2.基本概念 3.添加一组元素:Arrays.asList()方法接受一个数组或是一个用逗号分隔的元素列表(使用可变参数),并将其转换为一个LIst对象。Collections.addAll()方法接受一个Collection对象,以及一个数组或是一个用逗号分割的列表,将元 ...
分类:
编程语言 时间:
2016-08-13 19:37:41
阅读次数:
166
技术要点:Java的Arrays类提供了一个sort()方法,使用该方法可以很方便地对各种数组进行排序,大大降低了数组排序的难度。 ...
分类:
编程语言 时间:
2016-08-13 11:27:54
阅读次数:
244