1 def count_arithmetic_slices(nums: list[int]) -> int:
2 n = len(nums)
3 dp = [0] * n
4
5 for i in range(2, n):
6 if nums[i] - nums[i-1] == nums[i-1] - nums[i-2]:
7 dp[i] = dp[i - 1] + 1
8
9 return sum(dp)
10
1 array = [1, 2, 3]
2 reversed = array[::-1] # [3, 2, 1]
1 a = 10
2 b = 5
3 a, b = b, a
4 print(a, b) # 5 10
1 def recursive_factorial(n):
2 if n == 0:
3 return 1
4 return n * recursive_factorial(n - 1)
1 array = [1, 1, 2, 2, 2, 3]
2 max(set(array), key=array.count) # 2