Skip to content

Commit e63cc64

Browse files
committed
test: [20251106] Add (3607)
1 parent 9fc35d1 commit e63cc64

File tree

9 files changed

+59
-7
lines changed

9 files changed

+59
-7
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ members = [
370370
"problems/problems_1578",
371371
"problems/problems_3318",
372372
"problems/problems_3321",
373+
"problems/problems_3607",
373374
]
374375

375376
[package]
@@ -762,3 +763,4 @@ solution_2257 = { path = "problems/problems_2257", features = ["solution_2257"]
762763
solution_1578 = { path = "problems/problems_1578", features = ["solution_1578"] }
763764
solution_3318 = { path = "problems/problems_3318", features = ["solution_3318"] }
764765
solution_3321 = { path = "problems/problems_3321", features = ["solution_3321"] }
766+
solution_3607 = { path = "problems/problems_3607", features = ["solution_3607"] }

daily-problems.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"daily": "3321",
2+
"daily": "3607",
33
"plans": ["3683", "problems", "3684", "problems", "3685", "problems", "3686", "problems"]
44
}

golang/solution_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package golang
22

33
import (
4-
problem "leetCode/problems/problems_3321"
4+
problem "leetCode/problems/problems_3607"
55
"testing"
66
)
77

88
func TestSolution(t *testing.T) {
9-
TestEach(t, "3321", "problems", problem.Solve)
9+
TestEach(t, "3607", "problems", problem.Solve)
1010
}

problems/problems_3607/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "solution_3607"
3+
version = "0.1.0"
4+
edition = "2021"
5+
rust-version = "1.79.0"
6+
authors = ["benhao"]
7+
description = "LeetCode Solution 3607 in Rust"
8+
readme = "../../README.md"
9+
10+
[features]
11+
solution_3607 = []
12+
13+
[dependencies]
14+
serde_json = "1.0"
15+
rand = "0.8.4"
16+
regex = "1.10.5"
17+
library = { path = "../../rust/library", features = ["model"] }
18+
19+
[lib]
20+
name = "solution_3607"
21+
path = "solution.rs"

problems/problems_3607/problem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 3607. Power Grid Maintenance
1+
# 3607. Power Grid Maintenance [Rating: 1699.68]
22

33
<p data-end="401" data-start="120">You are given an integer <code data-end="194" data-start="191">c</code> representing <code data-end="211" data-start="208">c</code> power stations, each with a unique identifier <code>id</code> from 1 to <code>c</code> (1‑based indexing).</p>
44

problems/problems_3607/problem_zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 3607. 电网维护
1+
# 3607. 电网维护 [难度分: 1699.68]
22

33
<p data-end="401" data-start="120">给你一个整数 <code data-end="194" data-start="191">c</code>,表示 <code data-end="211" data-start="208">c</code> 个电站,每个电站有一个唯一标识符 <code>id</code>,从 1 到 <code>c</code>&nbsp;编号。</p>
44

problems/problems_3607/solution.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use serde_json::{json, Value};
2+
3+
pub struct Solution;
4+
5+
impl Solution {
6+
pub fn process_queries(c: i32, connections: Vec<Vec<i32>>, queries: Vec<Vec<i32>>) -> Vec<i32> {
7+
8+
}
9+
}
10+
11+
#[cfg(feature = "solution_3607")]
12+
pub fn solve(input_string: String) -> Value {
13+
let input_values: Vec<String> = input_string.split('\n').map(|x| x.to_string()).collect();
14+
let c: i32 = serde_json::from_str(&input_values[0]).expect("Failed to parse input");
15+
let connections: Vec<Vec<i32>> = serde_json::from_str(&input_values[1]).expect("Failed to parse input");
16+
let queries: Vec<Vec<i32>> = serde_json::from_str(&input_values[2]).expect("Failed to parse input");
17+
json!(Solution::process_queries(c, connections, queries))
18+
}

problems/problems_3607/solution.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function processQueries(c: number, connections: number[][], queries: number[][]): number[] {
2+
3+
};
4+
5+
export function Solve(inputJsonElement: string): any {
6+
const inputValues: string[] = inputJsonElement.split("\n");
7+
const c: number = JSON.parse(inputValues[0]);
8+
const connections: number[][] = JSON.parse(inputValues[1]);
9+
const queries: number[][] = JSON.parse(inputValues[2]);
10+
return processQueries(c, connections, queries);
11+
}

rust/test_executor/tests/solutions_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const PROBLEMS: [[&str; 2]; 1] = [["problems", "3321"]];
1+
const PROBLEMS: [[&str; 2]; 1] = [["problems", "3607"]];
22

33
#[cfg(test)]
44
mod test {
55
use test_executor::run_test::run_test;
66
use crate::PROBLEMS;
77

8-
use solution_3321 as solution;
8+
use solution_3607 as solution;
99

1010
#[test]
1111
fn test_solutions() {

0 commit comments

Comments
 (0)