1 #命名、变量、代码、函数 2 #this one is like your scripts with argv 3 def print_two(*args): 4 arg1, arg2 = args #将参数解包 5 print(f"arg1: {arg1}, arg2: {arg2}") 6 ...
分类:
编程语言 时间:
2020-07-18 13:33:56
阅读次数:
109
老规矩: 一个锁,一个队列。 不带参数的构造器,初始化一个长度为0?的对象数组。 collection参数的构造方法,直接array=c.toArray(); 数组入参array=arrays.copy。 进入正题: 可以看到它是先加了锁,然后新copy一个length+1的数组,设值之后再将新数组 ...
分类:
其他好文 时间:
2020-07-17 22:06:44
阅读次数:
66
XML文件可以采用多种编码,但是经过不同的编码后对于中文会出现乱码问题,比如“骞垮憡涓戦椈”,对于此问题的解决如下:static void Main() { string utf8String = "骞垮憡涓戦椈"; // Create two different encodings. Encodi ...
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 n ...
分类:
其他好文 时间:
2020-07-17 13:33:50
阅读次数:
46
一、Collections工具类 Collections 工具类常用方法: 排序 查找,替换 同步控制(不推荐,需要线程安全的集合类型时请考虑使用 JUC 包下的并发集合) 1. 排序 void reverse(List list)//反转 void shuffle(List list)//随机排序 ...
分类:
其他好文 时间:
2020-07-17 09:24:50
阅读次数:
78
static:静态的 1.可以用来修饰的结构:主要用来修饰类的内部结构 >属性、方法、代码块、内部类 2.static修饰属性:静态变量(或类变量) 2.1 属性,是否使用static修饰,又分为:静态属性 vs 非静态属性(实例变量) * 实例变量:我们创建了类的多个对象,每个对象都独立的拥一套类 ...
分类:
其他好文 时间:
2020-07-16 21:59:50
阅读次数:
66
Redis是什么 介绍:Redis是一个开源的key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型)。这些数据类型都支持push/po ...
分类:
其他好文 时间:
2020-07-16 21:54:23
阅读次数:
66
今天写了两个小练习 了解了一下JAVA的类部分 其中一个小练习是用工具类来完成随机数的产生和排序 另一个是让用户输入两个数并输出最大值 package a20200716;import java.util.Random;import java.util.Arrays;public class a20 ...
分类:
其他好文 时间:
2020-07-16 21:53:55
阅读次数:
50
1.涉及知识部分匹配表A 0AB 前缀A 后缀B 公共部分长度0ABA前缀:A AB 后缀:BA A 公共部分A,长度为1[0,0,1]package com.hy.tenalgorithm;import java.util.Arrays;/** * @author hanyong * @date ...
分类:
编程语言 时间:
2020-07-16 12:09:41
阅读次数:
51
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Now your job is to find the total ...
分类:
其他好文 时间:
2020-07-16 12:06:09
阅读次数:
75