5ms | O(m * n) | Rust
\n# Complexity\n- Time complexity: O(m * n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) 
\n# Complexity\n- Time complexity: $$O(m * n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimpl Solution {\n    pub fn check_arithmetic_subarrays(nums: Vec<i32>, l: Vec<i32>, r: Vec<i32>) -> Vec<bool> {\n        let mut ans = Vec::new();\n\n        for i in 0..l.len() {\n            let left = l[i] as usize;\n            let (min, max) = nums[left..=r[i] as usize].iter().fold(\n                (i32::MAX, i32::MIN), |acc, x| (acc.0.min(*x), acc.1.max(*x)));\n            if max == min { ans.push(true); continue };\n\n            let N = r[i] - l[i];\n            let d = (max - min) / N;\n            if (max - min) % N != 0 { ans.push(false); continue };\n\n            let mut visited = vec![false; N as usize + 1];\n            if (0..=N as usize).all(|j| {\n                if (nums[left+j] - min) % d != 0 || \n                visited[((nums[left+j] - min) / d) as usize] {\n                    false\n                } else {\n                    visited[((nums[left+j] - min) / d) as usize] = true;\n                    true\n            }})  { ans.push(true) }\n            else { ans.push(false) };\n        }\n\n        ans\n    }\n}\n```
['Rust']