1、Algorithm
題目:
給定一個整數(shù)數(shù)組 nums 和一個整數(shù)目標值 target,請你在該數(shù)組中找出 和為目標值 target 的那 兩個 整數(shù),并返回它們的數(shù)組下標。
示例 :
輸入: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("數(shù)組長度:" + nums.length + ";");
System.out.print("數(shù)組:[");
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 - 整數(shù),如
50 - 帶圓括號的字符串,如
(The Quick Brown Fox) - 引用其他對象,如
2 0 R,對對象2的引用。 - 對象的數(shù)組(有序集合),如
[50 30 /Fred],是一個包含三個項目的數(shù)組,按順序:50,30和/Fred。 - 字典(從名稱到對象的無序映射),如
<</Three 3 /Five 5>>,映射/Three到3和/Five到5。 - stream(流),它由字典和一些二進制數(shù)據(jù)組成。這些用于存儲PDF圖形運算符的流,以及其他二進制數(shù)據(jù),如圖像和字體。
例如,這是一個頁面對象,它是一個包含許多項目的字典,每個與名稱相關聯(lián):
<< /Type /Page
/MediaBox [0 0 612 792]
/Resources 3 0 R
/Parent 1 0 R
/Contents [4 0 R]
>>
這個詞典包含五個條目:
/Type /Page 名稱 /Page 與字典鍵 /Type 相關聯(lián)。
/MediaBox [0 0 612 792] 四個整數(shù) [0 0 612 792] 的數(shù)組與字典鍵 /MediaBox 相關聯(lián)。
/Resources 3 0 R 對象編號3與字典鍵 /Resources 相關聯(lián)。
/Parent 1 0 R 對象編號1與字典鍵 /Parent 對象相關聯(lián)。
/Contents [4 0 R] 間接引用 [4 0 R] 的單元素數(shù)組與字典鍵 /Contents 相關聯(lián)
Page Content
頁面內容是運算符列表,每個運算符前面都有零個或多個 操作數(shù)。這是一系列操作符,用于在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,所有出現(xiàn)都會被替換(g)。
4、Share 分享一個觀點
- 這周真是最最忙碌的一周,9月7號貴州政務版金格1.0遷移融合2.0,并且信創(chuàng)版本,不具備并行可能性,整體方案是金格1.0停機,融合2.0seal_manage庫數(shù)據(jù)關鍵表和初始化數(shù)據(jù)不動,底層金格一套數(shù)據(jù)是不變,并且之前測試遷移過一次,標記過某些表不需要清空,所以整體遷移還算順利。其中測試人員頻繁更換,政務側的功能新測試很多不熟悉。部分看板無數(shù)據(jù)或數(shù)據(jù)不對前期對不上。分配區(qū)域管理員功能未回歸,發(fā)現(xiàn)是機構的statisticsby字段不對。需要重新跑機構和印章數(shù)據(jù)。
- 9月7號西安2.7升級到3.4.0beta2,缺乏驗證導致。
-江西社會側上架贛企通,嚴格來講還是未按 流程辦事。管人靠制度,管事靠流程。