MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / count_quadruplets

Function count_quadruplets

1995-count-special-quadruplets.rs:1–15  ·  view source on GitHub ↗
(nums: Vec<i32>)

Source from the content-addressed store, hash-verified

1pub fn count_quadruplets(nums: Vec<i32>) -> i32 {
2 let mut ret = 0;
3 for a in 0..nums.len() {
4 for b in (a+1)..nums.len() {
5 for c in (b+1)..nums.len() {
6 for d in (c+1)..nums.len() {
7 if nums[a] + nums[b] + nums[c] == nums[d] {
8 ret += 1;
9 }
10 }
11 }
12 }
13 }
14 ret
15}
16
17fn main() {
18 let nums = vec![1,1,1,3,5];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected