1、Algorithm
题目:
给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。
示例 :
输入:nums = [2,7,11,15], target = 9
输出:[0,1]
解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。
public class HashMapTwoSum {
public static void main(String[] args) {
InputsForTwoNumberSum inputsForTwoNumberSum = new InputsForTwoNumberSum("4,4,4,5,6", "11");
PrintTool.printArray(twoSum(inputsForTwoNumberSum.nums,inputsForTwoNumberSum.target));
}
private static Integer[] twoSum(Integer[] nums,Integer target){
Integer[] ints = new Integer[2];
HashMap<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < nums.length; i++) {
map.put(nums[i],i);
}
for (int i = 0; i < nums.length; i++) {
if (map.containsKey(target-nums[i])){
int j=map.get(target-nums[i]);
if (i!=j){
return new Integer[]{i,j};
}
}
}
return ints;
}
}
public class PrintTool {
public static void printArray(Integer[] nums){
System.out.println("数组长度:" + nums.length + ";");
System.out.print("数组:[");
for (int i = 0; i < nums.length; i++) {
System.out.print(nums[i]);
if (i < nums.length - 1) {
System.out.print(",");
}
}
System.out.print("]");
}
}
public class InputsForTwoNumberSum {
public Integer[] nums;
public int target = 9;
public InputsForTwoNumberSum(String numstr, String target){
String[] numberList = numstr.split(",");
nums = new Integer[numberList.length];
for(int i = 0; i<numberList.length; i++){
nums[i] = Integer.parseInt(numberList[i]);
}
this.target = Integer.parseInt(target);
}
}
2、Review 阅读一篇英文文章
Document Content
文档内容包括由以下元素构建的对象:
- 名称,写为
/Name
- 整数,如
50
- 带圆括号的字符串,如
(The Quick Brown Fox)
- 引用其他对象,如
2 0 R
,对对象2的引用。 - 对象的数组(有序集合),如
[50 30 /Fred]
,是一个包含三个项目的数组,按顺序:50
,30
和/Fred
。 - 字典(从名称到对象的无序映射),如
<</Three 3 /Five 5>>
,映射/Three
到3
和/Five
到5
。 - stream(流),它由字典和一些二进制数据组成。这些用于存储PDF图形运算符的流,以及其他二进制数据,如图像和字体。
例如,这是一个页面对象,它是一个包含许多项目的字典,每个与名称相关联:
<< /Type /Page
/MediaBox [0 0 612 792]
/Resources 3 0 R
/Parent 1 0 R
/Contents [4 0 R]
>>
这个词典包含五个条目:
/Type /Page 名称 /Page 与字典键 /Type 相关联。
/MediaBox [0 0 612 792] 四个整数 [0 0 612 792] 的数组与字典键 /MediaBox 相关联。
/Resources 3 0 R 对象编号3与字典键 /Resources 相关联。
/Parent 1 0 R 对象编号1与字典键 /Parent 对象相关联。
/Contents [4 0 R] 间接引用 [4 0 R] 的单元素数组与字典键 /Contents 相关联
Page Content
页面内容是运算符列表,每个运算符前面都有零个或多个 操作数。这是一系列操作符,用于在36号字体选择/F0字体并放置 当前位置的文字:
/F0 36.0 Tf
(Hello, World!) Tj
3、Techniques/Tips 分享一个技巧
- 查找某个文件夹下文件大小排名 :
Find and list the largest files in a directory (e.g.. /home ) sorted by size
du -ah /home | grep '^ *[0-9.]+G' |sort -rh|head -n 10 - 关于vim查找并替换
:s(substitute)命令用来查找和替换字符串。语法如下:
:{作用范围}s/{目标}/{替换}/{替换标志}
例如 :%s/foo/bar/g 会在全局范围(%)查找 foo 并替换为 bar,所有出现都会被替换(g)。
4、Share 分享一个观点
- 这周真是最最忙碌的一周,9月7号贵州政务版金格1.0迁移融合2.0,并且信创版本,不具备并行可能性,整体方案是金格1.0停机,融合2.0seal_manage库数据关键表和初始化数据不动,底层金格一套数据是不变,并且之前测试迁移过一次,标记过某些表不需要清空,所以整体迁移还算顺利。其中测试人员频繁更换,政务侧的功能新测试很多不熟悉。部分看板无数据或数据不对前期对不上。分配区域管理员功能未回归,发现是机构的statisticsby字段不对。需要重新跑机构和印章数据。
- 9月7号西安2.7升级到3.4.0beta2,缺乏验证导致。
-江西社会侧上架赣企通,严格来讲还是未按 流程办事。管人靠制度,管事靠流程。