This commit is contained in:
SquidSpirit 2025-09-22 11:11:34 +08:00
parent 5a8e1adf41
commit 19824a8846
3 changed files with 37 additions and 0 deletions

7
706_design_hashmap/Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "design_hashmap"
version = "0.1.0"

View File

@ -0,0 +1,6 @@
[package]
name = "design_hashmap"
version = "0.1.0"
edition = "2024"
[dependencies]

View File

@ -0,0 +1,24 @@
#[derive(Clone)]
struct ListNode {
key: i32,
value: i32,
next: Option<Box<ListNode>>,
}
pub struct MyHashMap {
buckets: Vec<Option<Box<ListNode>>>,
}
impl MyHashMap {
fn new() -> Self {
Self {
buckets: Vec::with_capacity(8192),
}
}
fn put(&self, key: i32, value: i32) {}
fn get(&self, key: i32) -> i32 {}
fn remove(&self, key: i32) {}
}