逗号的作用:输出空格 [root@zhangchao ~]# cat zc.log root:x:0:0:root:/root:/bin/bash operator:x:11:0:operator:/root:/sbin/nologin [root@zhangchao ~]# awk -F":" ' ...
分类:
其他好文 时间:
2020-06-15 11:47:15
阅读次数:
49
1035 插入与归并 (25分) 数据比较小,归并不用写合并函数,直接sort 中间序列不包括初始序列 #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> ...
分类:
编程语言 时间:
2020-06-15 10:10:59
阅读次数:
53
func merge(left,right []int) (result []int) { r,l := 0,0 for l < len(left) && r < len(right) { if left[l] < right[r]{ result = append(result,left[l]) ...
分类:
编程语言 时间:
2020-06-14 19:03:35
阅读次数:
62
java数组排序详细讲解 前言: 几种常用的JAVA数组排序方法的整合。 java数组排序 法一:Arrays.sort() Arrays.sort()排序方法在java中是最简单且最常用的排序方法 int []arr1= {45,34,59,55}; Arrays.sort(arr1);//调用方 ...
分类:
编程语言 时间:
2020-06-14 18:49:51
阅读次数:
51
哈希表 思路 遍历数组arr,并用map记录各元素出现的次数 根据map的key把对应的value提出 并保存在数组val中。(KeySet()获取map中所有的key) 遍历排序后的数组val,同时与k比较,更新k的值 代码 //55ms public static int findLeastNu ...
分类:
其他好文 时间:
2020-06-14 17:01:04
阅读次数:
54
链接:https://leetcode-cn.com/problems/4sum/ 代码 class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> ans = n ...
分类:
其他好文 时间:
2020-06-13 21:04:30
阅读次数:
53
string = input().split() dic = {} for i in string: dic[i] = dic.get(i,0) + 1 dic = sorted(dic.items(), key=lambda x: x[1],reverse=True) for key,value ...
分类:
其他好文 时间:
2020-06-13 19:26:20
阅读次数:
89
一、new Set()方法 Set对象允许你存储任何类型的唯一值,无论是原始值或者是对象引用。 function removeRepeatElement(arr) { return Array.from(new Set(arr)); } 注意:要用Array.from()来将Set对象转换成一个真的 ...
分类:
编程语言 时间:
2020-06-13 17:29:17
阅读次数:
52
#include<iostream>#include<algorithm>#include<cstring>#include<cstdio>using namespace std;const int N=1e6+10;int q[N]= {0},temp[N]={0};void merge_sort ...
分类:
编程语言 时间:
2020-06-13 12:48:12
阅读次数:
52
sort($array); //数组升序排序 rsort($array); //数组降序排序 asort($array); //根据值,以升序对关联数组进行排序 ksort($array); //根据建,以升序对关联数组进行排序 arsort($array); //根据值,以降序对关联数组进行排序 ...
分类:
编程语言 时间:
2020-06-13 10:31:43
阅读次数:
69