mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
Format the Java codes with the Reat Hat extension.
This commit is contained in:
@ -32,7 +32,7 @@ public class hashing_search {
|
||||
// 初始化哈希表
|
||||
Map<Integer, Integer> map = new HashMap<>();
|
||||
for (int i = 0; i < nums.length; i++) {
|
||||
map.put(nums[i], i); // key: 元素,value: 索引
|
||||
map.put(nums[i], i); // key: 元素,value: 索引
|
||||
}
|
||||
int index = hashingSearchArray(map, target);
|
||||
System.out.println("目标元素 3 的索引 = " + index);
|
||||
@ -42,7 +42,7 @@ public class hashing_search {
|
||||
// 初始化哈希表
|
||||
Map<Integer, ListNode> map1 = new HashMap<>();
|
||||
while (head != null) {
|
||||
map1.put(head.val, head); // key: 节点值,value: 节点
|
||||
map1.put(head.val, head); // key: 节点值,value: 节点
|
||||
head = head.next;
|
||||
}
|
||||
ListNode node = hashingSearchLinkedList(map1, target);
|
||||
|
||||
Reference in New Issue
Block a user