1937. Maximum Number of Points with Cost

You are given an m x n integer matrix points (0-indexed). Starting with 0 points, you want to maximize the number of points you can get from the matrix. To gain points, you must pick one cell in each row. Picking the cell at coordinates (r, c) will add points[r][c] to your score. However, you will lose points if you pick a cell too far from the cell that you picked in the previous row....

<span title='2022-01-23 00:00:00 +0000 UTC'>January 23, 2022</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

673. Number of Longest Increasing Subsequence

Given an integer array nums, return the number of longest increasing subsequences. Notice that the sequence has to be strictly increasing. 1 2 3 4 5 6 7 8 9 10 11 Example 1: Input: nums = [1,3,5,4,7] Output: 2 Explanation: The two longest increasing subsequences are [1, 3, 4, 7] and [1, 3, 5, 7]. Example 2: Input: nums = [2,2,2,2,2] Output: 5 Explanation: The length of longest continuous increasing subsequence is 1, and there are 5 subsequences' length is 1, so output 5....

<span title='2021-11-26 00:00:00 +0000 UTC'>November 26, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1269. Number of Ways to Stay in the Same Place After Some Steps

You have a pointer at index 0 in an array of size arrLen. At each step, you can move 1 position to the left, 1 position to the right in the array, or stay in the same place (The pointer should not be placed outside the array at any time). Given two integers steps and arrLen, return the number of ways such that your pointer still at index 0 after exactly steps steps....

<span title='2021-11-07 00:00:00 +0000 UTC'>November 7, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

413. Arithmetic Slices

An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, [1,3,5,7,9], [7,7,7,7], and [3,-1,-5,-9] are arithmetic sequences. Given an integer array nums, return the number of arithmetic subarrays of nums. A subarray is a contiguous subsequence of the array. 1 2 3 4 5 6 7 8 9 10 Example 1: Input: nums = [1,2,3,4] Output: 3 Explanation: We have 3 arithmetic slices in nums: [1, 2, 3], [2, 3, 4] and [1,2,3,4] itself....

<span title='2021-10-26 00:00:00 +0000 UTC'>October 26, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

Wine Selling Problem

Wine Selling Problem Problem statement: Given n wines in a row, with integers denoting the cost of each wine respectively. Each year you can sell the first or the last wine in the row. Let the initial profits from the wines be P1, P2, P3…Pn. In the Yth year, the profit from the ith wine will be Y*P[i]. The goal is to calculate the maximum profit that can be earned by selling all the wines....

<span title='2021-07-04 00:00:00 +0000 UTC'>July 4, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx

343. Integer Break

343. Integer Break Given an integer n, break it into the sum of k positive integers, where k >= 2, and maximize the product of those integers. Return the maximum product you can get. 1 2 3 4 5 6 7 8 9 10 11 Example 1: Input: n = 2 Output: 1 Explanation: 2 = 1 + 1, 1 × 1 = 1. Example 2: Input: n = 10 Output: 36 Explanation: 10 = 3 + 3 + 4, 3 × 3 × 4 = 36....

<span title='2021-05-30 00:00:00 +0000 UTC'>May 30, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

221. Maximal Square

221. Maximal Square Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. 1 2 3 4 Example 1: Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]] Output: 4 1 2 3 4 Example 2: Input: matrix = [["0","1"],["1","0"]] Output: 1 1 2 3 4 Example 3: Input: matrix = [["0"]] Output: 0 Constraints: m == matrix.length n == matrix[i].length 1 <= m, n <= 300 matrix[i][j] is ‘0’ or ‘1’....

<span title='2021-05-28 00:00:00 +0000 UTC'>May 28, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

472. Concatenated Words

472. Concatenated Words Given an array of strings words (without duplicates), return all the concatenated words in the given list of words. A concatenated word is defined as a string that is comprised entirely of at least two shorter words in the given array. 1 2 3 4 5 6 7 8 9 10 11 12 Example 1: Input: words = ["cat","cats","catsdogcats","dog","dogcatsdog","hippopotamuses","rat","ratcatdogcat"] Output: ["catsdogcats","dogcatsdog","ratcatdogcat"] Explanation: "catsdogcats" can be concatenated by "cats", "dog" and "cats"; "dogcatsdog" can be concatenated by "dog", "cats" and "dog"; "ratcatdogcat" can be concatenated by "rat", "cat", "dog" and "cat"....

<span title='2021-05-23 00:00:00 +0000 UTC'>May 23, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

93. Restore IP Addresses

93. Restore IP Addresses Given a string s containing only digits, return all possible valid IP addresses that can be obtained from s. You can return them in any order. A valid IP address consists of exactly four integers, each integer is between 0 and 255, separated by single dots and cannot have leading zeros. For example, “0.1.2.201” and “192.168.1.1” are valid IP addresses and “0.011.255.245”, “192.168.1.312” and “192.168@1.1” are invalid IP addresses....

<span title='2021-05-21 00:00:00 +0000 UTC'>May 21, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

139. Word Break

139. Word Break Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may be reused multiple times in the segmentation. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Example 1: Input: s = "leetcode", wordDict = ["leet","code"] Output: true Explanation: Return true because "leetcode" can be segmented as "leet code"....

<span title='2021-05-20 00:00:00 +0000 UTC'>May 20, 2021</span>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;volyx

322. Coin Change

322. Coin Change You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. You may assume that you have an infinite number of each kind of coin....

<span title='2021-05-20 00:00:00 +0000 UTC'>May 20, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

91. Decode Ways

91. Decode Ways A message containing letters from A-Z can be encoded into numbers using the following mapping: ‘A’ -> “1” ‘B’ -> “2” … ‘Z’ -> “26” To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For example, “11106” can be mapped into: “AAJF” with the grouping (1 1 10 6) “KJF” with the grouping (11 10 6) Note that the grouping (1 11 06) is invalid because “06” cannot be mapped into ‘F’ since “6” is different from “06”....

<span title='2021-05-20 00:00:00 +0000 UTC'>May 20, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

276. Paint Fence

276. Paint Fence You are painting a fence of n posts with k different colors. You must paint the posts following these rules: Every post must be painted exactly one color. At most one pair of adjacent fence posts can have the same color. Given the two integers n and k, return the number of ways you can paint the fence. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Example 1: Input: n = 3, k = 2 Output: 6 Explanation: All the possibilities are shown....

<span title='2021-05-17 00:00:00 +0000 UTC'>May 17, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

63. Unique Paths II

63. Unique Paths II A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the diagram below). Now consider if some obstacles are added to the grids. How many unique paths would there be?...

<span title='2021-05-16 00:00:00 +0000 UTC'>May 16, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

64. Minimum Path Sum

64. Minimum Path Sum Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. Note: You can only move either down or right at any point in time. 1 2 3 4 5 Example 1: Input: grid = [[1,3,1],[1,5,1],[4,2,1]] Output: 7 Explanation: Because the path 1 → 3 → 1 → 1 → 1 minimizes the sum....

<span title='2021-05-16 00:00:00 +0000 UTC'>May 16, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx