All Posts

Leetcode 2762: Continuous Subarrays

You are given a 0-indexed integer array ’nums’. A subarray of ’nums’ is called continuous if the absolute difference between any two elements in the subarray is less than or equal to 2. Return the total number of continuous subarrays.

Leetcode 2944: Minimum Number of Coins for Fruits

You are given a list of integers ‘prices’, where each element ‘prices[i]’ represents the cost to purchase the ‘i’-th fruit. If you buy the ‘i’-th fruit at prices[i] coins, you get all subsequent fruits for free. Your task is to determine the minimum number of coins required to purchase all the fruits.