diff --git a/solution/2500-2599/2562.Find the Array Concatenation Value/README.md b/solution/2500-2599/2562.Find the Array Concatenation Value/README.md index 0b0639ca03e35..bb250393f4705 100644 --- a/solution/2500-2599/2562.Find the Array Concatenation Value/README.md +++ b/solution/2500-2599/2562.Find the Array Concatenation Value/README.md @@ -197,6 +197,25 @@ impl Solution { } ``` +```rust +impl Solution { + pub fn find_the_array_conc_val(nums: Vec) -> i64 { + let mut ans = 0; + let mut n = nums.len(); + + for i in 0..n / 2 { + ans += format!("{}{}", nums[i], nums[n - i - 1]).parse::().unwrap(); + } + + if n % 2 != 0 { + ans += nums[n / 2] as i64; + } + + ans + } +} +``` + ### **C** ```c diff --git a/solution/2500-2599/2562.Find the Array Concatenation Value/README_EN.md b/solution/2500-2599/2562.Find the Array Concatenation Value/README_EN.md index f90ead7196adb..9c59b80ab1645 100644 --- a/solution/2500-2599/2562.Find the Array Concatenation Value/README_EN.md +++ b/solution/2500-2599/2562.Find the Array Concatenation Value/README_EN.md @@ -190,6 +190,25 @@ impl Solution { } ``` +```rust +impl Solution { + pub fn find_the_array_conc_val(nums: Vec) -> i64 { + let mut ans = 0; + let mut n = nums.len(); + + for i in 0..n / 2 { + ans += format!("{}{}", nums[i], nums[n - i - 1]).parse::().unwrap(); + } + + if n % 2 != 0 { + ans += nums[n / 2] as i64; + } + + ans + } +} +``` + ### **C** ```c