Best Time to Buy and Sell Stock with Cooldown Leetcode Solution

Problem statement In the problem “Best Time to Buy and Sell Stock with Cooldown” we are given an array where each element in the array contains the price of the given stock on that day. There is no restriction on the number of transactions. The definition of the transaction is …

Read more

Can Make Arithmetic Progression From Sequence Leetcode Solution

Problem statement In the problem ” Can Make Arithmetic Progression From Sequence” we are given an array, now we need to answer if it is possible to generate an Arithmetic Progression by rearranging the sequence. Example arr = [3,1,5] true Explanation: We can rearrange the array as{1,3,5} which forms an …

Read more

Best Time to Buy and Sell Stock  II Leetcode Solution

Problem statement In the problem “Best Time to Buy and Sell Stock  II,” we are given an array where each element in the array contains the price of the given stock on that day. The definition of the transaction is buying one share of stock and selling that one share …

Read more

Best Time to Buy and Sell Stock with Transaction Fee Leetcode Solution

Problem statement In the problem “Best Time to Buy and Sell Stock with Transaction Fee,” we are given an array where each element in the array contains the price of the given stock on that day. The definition of the transaction is buying one share of stock and selling that …

Read more

Count Negative Numbers in a Sorted Matrix LeetCode Solution

Problem statement In the problem “Count Negative Numbers in a Sorted Matrix” we are given a matrix of n rows and m columns. Elements are sorted in decreasing order both row-wise and column-wise. We need to find the total number of negative elements in the matrix. Example grid = [[8,3,2,-1],[4,2,1,-1],[3,1,-1,-2],[-1,-1,-2,-3]] …

Read more

Translate »