mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
Add figures to replace_linear_by_hashing.md
This commit is contained in:
@ -43,7 +43,7 @@ let package = Package(
|
||||
.executable(name: "graph_bfs", targets: ["graph_bfs"]),
|
||||
.executable(name: "graph_dfs", targets: ["graph_dfs"]),
|
||||
// chapter_searching
|
||||
.executable(name: "leetcode_two_sum", targets: ["leetcode_two_sum"]),
|
||||
.executable(name: "two_sum", targets: ["two_sum"]),
|
||||
.executable(name: "linear_search", targets: ["linear_search"]),
|
||||
.executable(name: "hashing_search", targets: ["hashing_search"]),
|
||||
// chapter_sorting
|
||||
@ -104,7 +104,7 @@ let package = Package(
|
||||
.executableTarget(name: "graph_bfs", dependencies: ["utils", "graph_adjacency_list_target"], path: "chapter_graph", sources: ["graph_bfs.swift"]),
|
||||
.executableTarget(name: "graph_dfs", dependencies: ["utils", "graph_adjacency_list_target"], path: "chapter_graph", sources: ["graph_dfs.swift"]),
|
||||
// chapter_searching
|
||||
.executableTarget(name: "leetcode_two_sum", path: "chapter_searching", sources: ["leetcode_two_sum.swift"]),
|
||||
.executableTarget(name: "two_sum", path: "chapter_searching", sources: ["two_sum.swift"]),
|
||||
.executableTarget(name: "linear_search", dependencies: ["utils"], path: "chapter_searching", sources: ["linear_search.swift"]),
|
||||
.executableTarget(name: "hashing_search", dependencies: ["utils"], path: "chapter_searching", sources: ["hashing_search.swift"]),
|
||||
// chapter_sorting
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: leetcode_two_sum.swift
|
||||
* File: two_sum.swift
|
||||
* Created Time: 2023-01-03
|
||||
* Author: nuomi1 (nuomi1@qq.com)
|
||||
*/
|
||||
@ -37,7 +37,7 @@ enum LeetcodeTwoSum {
|
||||
static func main() {
|
||||
// ======= Test Case =======
|
||||
let nums = [2, 7, 11, 15]
|
||||
let target = 9
|
||||
let target = 13
|
||||
// ====== Driver Code ======
|
||||
// 方法一
|
||||
var res = twoSumBruteForce(nums: nums, target: target)
|
||||
Reference in New Issue
Block a user