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

anonymous


1 getItem(key) { 2 if (typeof window !== 'undefined' && typeof Storage !== undefined) { 3 return localStorage.getItem(key); 4 } 5 6 return null; 7 }

anonymous


1 .fadein { 2 animation: fadein linear 1s; 3 } 4 5 @keyframes fadein { 6 from { opacity: 0; } 7 to { opacity: 1; } 8 }

Linkerin


1 function slugify(value) { 2 return value 3 .toString() 4 .normalize('NFD') // split an accented letter in the base letter and the accent 5 .replace(/[\u0300-\u036f]/g, '') // remove all the accents 6 .toLowerCase() 7 .replace(/[^a-z0-9 -]/g, '') // replace all chars that are not letters, numbers and spaces 8 .trim() 9 .replace(/\s+/g, '-');} 10 slugify('Hello world'); // 'hello-world'