C# Solution for Arithmetic Subarrays Problem
Intuition\n Describe your first thoughts on how to solve this problem. \nThis approach involves iterating through the range queries, extracting the subarrays fr
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThis approach involves iterating through the range queries, extracting the subarrays from the given nums array, and checking whether the subarrays form an arithmetic sequence without explicitly sorting them. The method IsArithmeticSequence determines this property by calculating the difference between consecutive elements and verifying if it remains consistent throughout the subarray\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1.\tIterate through the range queries provided by l and r.\n2.\tFor each query, extract the subarray from nums.\n3.\tCheck if the extracted subarray forms an arithmetic sequence using the IsArithmeticSequence method.\n4.\tRecord the result for each query.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\u2022\tThere are m range queries to process.\n\u2022\tFor each query, extracting the subarray takes O(n) time (where n is the size of the subarray).\n\u2022\tCalculating the difference between consecutive elements and checking for an arithmetic sequence takes O(n) time.\n\u2022\tOverall time complexity: O(m * n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\u2022\tSpace complexity is primarily attributed to the storage of the result list and the subarrays extracted.\n\u2022\tThe result list holds m boolean values.\n\u2022\tFor each query, the subarray extraction needs additional space.\n\u2022\tOverall space complexity: O(m * n) for the result list and subarrays.\n\n# Code\n```\npublic class Solution {\n    public IList<bool> CheckArithmeticSubarrays(int[] nums, int[] l, int[] r) {\n        List<bool> result = new List<bool>();\n        \n        for (int i = 0; i < l.Length; i++) {\n            int left = l[i];\n            int right = r[i];\n            \n            // Extract subarray\n            int[] subarray = new int[right - left + 1];\n            Array.Copy(nums, left, subarray, 0, right - left + 1);\n            \n            // Check arithmetic sequence\n            result.Add(IsArithmeticSequence(subarray));\n        }\n        \n        return result;\n    }\n\n    private bool IsArithmeticSequence(int[] arr) {\n        Array.Sort(arr); // Sorting the subarray\n        \n        int diff = arr[1] - arr[0];\n        for (int i = 2; i < arr.Length; i++) {\n            if (arr[i] - arr[i - 1] != diff) {\n                return false;\n            }\n        }\n        \n        return true;\n    }\n}\n```
['C#']