码迷,mamicode.com
首页 >  
搜索关键字:Arrays    ( 3585个结果
Stream(二)
public class Test { /* * Stream接口: * 实现类 * IntStream * DoubleStream * LongStream * * 一、创建Stream * 1、方式一:通过集合创建 * 集合对象.stream() * 2、方式二:通过数组工具类Arrays * ...
分类:其他好文   时间:2020-03-14 12:46:15    阅读次数:45
扑克牌之斗地主
package com.d313;/*@author DDC* @date 2020-3-13 22:00* */import java.util.Arrays;import java.util.Random;public class PokerDemo { public static void m ...
分类:其他好文   时间:2020-03-13 22:20:17    阅读次数:60
关于数组(Arrays)与 工具类Arrays
关于数组(Arrays) 数组的定义 静态初始化 动态初始化 系统分配数组的初始值: byte short int long :0 float double :0.0 char :\u0000 boolean:false 类、接口、数组:null 使用数组 关于二维数组的使用: 工具类Arrays ...
分类:编程语言   时间:2020-03-12 15:56:28    阅读次数:73
leetcode 3. Longest Substring Without Repeating Characters (java)
class Solution { public int lengthOfLongestSubstring(String s) { int[] dict = new int[256]; Arrays.fill(dict, -1); int maxLen = 0, start = -1; for (in ...
分类:编程语言   时间:2020-03-12 14:37:50    阅读次数:71
leetcode 4. Median of Two Sorted Arrays (java)
class Solution { public double findMedianSortedArrays(int[] nums1, int[] nums2) { int len1 = nums1.length; int len2 = nums2.length; if (len1 == 0 && l ...
分类:编程语言   时间:2020-03-12 14:20:50    阅读次数:59
Java:Arrays类
java.utl包的Arrays类包含了用来操作数组的各种方法,本Blog就将介绍数组的各种操作。 ...
分类:编程语言   时间:2020-03-12 09:33:17    阅读次数:56
CF-Educational Codeforces Round 83-D-Count the Arrays
题目传送门 sol:首先我们考虑在一个长度为$n$的序列里只有一个数出现了两次其他数都只出现了一次,那么在序列中出现过的数就有$n - 1$个。而这些数的范围是$[1, m]$,从$[1, m]$里选$n - 1$个不同的数的方案数为$C_{m}^{n - 1}$。这$n - 1$个数里最大的数不能 ...
分类:其他好文   时间:2020-03-10 13:47:14    阅读次数:45
Codeforces1312D Count the Arrays 组合数学
题意 给你$n$和$m$,问满足以下条件的数列的个数: 数列长度为$n$ 数列值域范围为$\left[1,m\right]$ 数列有且仅有一对相等的数 数列是单峰数列(先严格递增后严格递减,严格递增或严格递减) 解题思路 首先从$m$元素中挑出$n 1$个不同的值,有$C_m^{n 1}$种方法。现 ...
分类:其他好文   时间:2020-03-10 11:57:17    阅读次数:95
Codeforces 1312D. Count the Arrays
Codeforces 1312D. Count the Arrays 题意: 计算满足如下要求的序列的数量。 + 1:序列长度为$n$。 + 2:序列中的元素为1~m。 + 3:序列中有且仅有一对数字相等。 + 4:序列有一个分界点,分界点左边的数字严格单调递增,右边的数字严格单调递减。 数据范围: ...
分类:其他好文   时间:2020-03-10 09:14:34    阅读次数:75
Leetcode-018-四数之和
和三数之和思路一样,先排序,再双指针。 class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { Arrays.sort(nums); List<List<Integer>> res = new Arr ...
分类:其他好文   时间:2020-03-09 23:54:02    阅读次数:95
3585条   上一页 1 ... 32 33 34 35 36 ... 359 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!