MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / fail

Method fail

Two Pointers/457. Circular Array Loop/src/main.rs:49–56  ·  view source on GitHub ↗

reach a fail node, fail this way

(i: usize, j: usize, nums: &Vec<i32>, vec: &mut Vec<i32>)

Source from the content-addressed store, hash-verified

47
48 /// reach a fail node, fail this way
49 pub fn fail(i: usize, j: usize, nums: &Vec<i32>, vec: &mut Vec<i32>) {
50 let mut idx = i;
51 while idx != j {
52 let next = Self::next_idx(idx, nums[idx], nums.len());
53 vec[idx] = 0;
54 idx = next;
55 }
56 }
57}
58
59#[cfg(test)]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected