题目: You are given a sequence a1,a2,…,an consisting of n non-zero integers (i.e. ai≠0). You have to calculate two following values: the number of pairs ...
分类:
其他好文 时间:
2020-06-14 16:59:19
阅读次数:
54
Description 要你求每个元素都在$[1,m]$,存在一个位置左边严格递增,右边严格递减,且恰好存在一对相等元素的$n$个元素的数组的数量$(1 \leq n \leq m \leq 2 * 10^5)$ Solution 枚举数组中的最大值$max$,有$max \geq n - 1$当数 ...
分类:
其他好文 时间:
2020-06-14 14:34:40
阅读次数:
51
原文链接:Redis实现消息队列的方案 Redis作为内存中的数据结构存储,常用作数据库、缓存和消息代理。它支持数据结构,如 字符串,散列,列表,集合,带有范围查询的排序集(sorted sets),位图(bitmaps),超级日志(hyperloglogs),具有半径查询和流的地理空间索引。Red ...
分类:
其他好文 时间:
2020-06-14 11:13:43
阅读次数:
163
1. 元注解@Inherited继承 package com.example.demo; import java.lang.annotation.*; import java.util.Arrays; public class Test { public static void main(Strin ...
分类:
编程语言 时间:
2020-06-13 21:12:40
阅读次数:
62
链接: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
descption We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Note that '0' is not included.) Now, we writ ...
分类:
其他好文 时间:
2020-06-13 17:10:49
阅读次数:
64
package club.interview.algorithm.eor; import java.util.Arrays; /** * 异或运算 == 无进位相加 * 1. 找到整数二进制最后一个1的下标位置 {@link EorT#findIndexOne(int)} } * 2. 统计整数二进 ...
分类:
编程语言 时间:
2020-06-13 12:43:18
阅读次数:
48
原题链接 https://www.luogu.com.cn/problem/CF1360H 题目大意 题解 ① 最常见最暴力的做法: 将读入的二进制转化为十进制,然后依次删除,删除过程中维护中位数; 虽然思路简单,但是考虑到实际维护的过程中十分复杂,对代码能力要求较高; ② 稍微巧妙一点的做法: 其 ...
分类:
其他好文 时间:
2020-06-11 19:33:49
阅读次数:
54
jdk8新语法: JDK8 JDK1.0 95 Vector Hashtable synchronized JDK1.2 98 List Set Map JDK1.5 2004 泛型 枚举 标注 多线程 自动封箱 静态导入 可变长参数(本文档有讲解) JDK6 Arrays.copyOf() JDK ...
分类:
其他好文 时间:
2020-06-11 16:23:29
阅读次数:
50