Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
ArXiv:
Tags:
competitive-programming
code-generation
specification-generation
proof-generation
verification
rust
License:
Download leetcode/lc1524/code.rs from Gax-c/VeriContest_Lite: direct link, hf CLI and curl.
- Browser
- Download file 521 Bytes
-
https://huggingface.co/datasets/Gax-c/VeriContest_Lite/resolve/main/leetcode/lc1524/code.rs
- Command line
-
hf download hf://datasets/Gax-c/VeriContest_Lite/leetcode/lc1524/code.rs
-
curl -L -o code.rs https://huggingface.co/datasets/Gax-c/VeriContest_Lite/resolve/main/leetcode/lc1524/code.rs
521 Bytes
| impl Solution { | |
| pub fn num_of_subarrays(arr: Vec<i32>) -> i32 { | |
| let mut odd: i64 = 0; | |
| let mut even: i64 = 0; | |
| let mut res: i64 = 0; | |
| let mut i: usize = 0; | |
| while i < arr.len() { | |
| if arr[i] % 2 == 0 { | |
| even = even + 1; | |
| } else { | |
| let tmp = odd; | |
| odd = even + 1; | |
| even = tmp; | |
| } | |
| res = (res + odd) % 1_000_000_007i64; | |
| i = i + 1; | |
| } | |
| res as i32 | |
| } | |
| } | |