198. House Robber

198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given an integer array nums representing the amount of money of each house, return the maximum amount of money you can rob tonight without alerting the police....

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

438. Find All Anagrams in a String

438. Find All Anagrams in a String Given two strings s and p, return an array of all the start indices of p’s anagrams in s. You may return the answer in any order. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Example 1: Input: s = "cbaebabacd", p = "abc" Output: [0,6] Explanation: The substring with start index = 0 is "cba", which is an anagram of "abc"....

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

1208. Get Equal Substrings Within Budget

1208. Get Equal Substrings Within Budget You are given two strings s and t of the same length. You want to change s to t. Changing the i-th character of s to i-th character of t costs |s[i] - t[i]| that is, the absolute difference between the ASCII values of the characters. You are also given an integer maxCost. Return the maximum length of a substring of s that can be changed to be the same as the corresponding substring of twith a cost less than or equal to maxCost....

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

1344. Angle Between Hands of a Clock

1344. Angle Between Hands of a Clock Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minute hand. 1 2 3 4 Example 1: Input: hour = 12, minutes = 30 Output: 165 1 2 3 4 Example 2: Input: hour = 3, minutes = 30 Output: 75 1 2 3 4 Example 3: Input: hour = 3, minutes = 15 Output: 7....

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

443. String Compression

1343. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold Given an array of integers arr and two integers k and threshold. Return the number of sub-arrays of size k and average greater than or equal to threshold. 1 2 3 4 5 Example 1: Input: arr = [2,2,2,2,5,5,5,8], k = 3, threshold = 4 Output: 3 Explanation: Sub-arrays [2,5,5],[5,5,5] and [5,5,8] have averages 4, 5 and 6 respectively....

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

443. String Compression

443. String Compression Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating characters in chars: If the group’s length is 1, append the character to s. Otherwise, append the character followed by the group’s length. The compressed string s should not be returned separately, but instead be stored in the input character array chars. Note that group lengths that are 10 or longer will be split into multiple characters in chars....

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

1845. Seat Reservation Manager

1845. Seat Reservation Manager Design a system that manages the reservation state of n seats that are numbered from 1 to n. Implement the SeatManager class: SeatManager(int n) Initializes a SeatManager object that will manage n seats numbered from 1 to n. All seats are initially available. int reserve() Fetches the smallest-numbered unreserved seat, reserves it, and returns its number. void unreserve(int seatNumber) Unreserves the seat with the given seatNumber. 1 2 3 4 5 6 7 Example 1: Input ["SeatManager", "reserve", "reserve", "unreserve", "reserve", "reserve", "reserve", "reserve", "unreserve"] [[5], [], [], [2], [], [], [], [], [5]] Output [null, 1, 2, null, 2, 3, 4, 5, null] Explanation SeatManager seatManager = new SeatManager(5); // Initializes a SeatManager with 5 seats....

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

1846. Maximum Element After Decreasing and Rearranging

1846. Maximum Element After Decreasing and Rearranging You are given an array of positive integers arr. Perform some operations (possibly none) on arr so that it satisfies these conditions: The value of the first element in arr must be 1. The absolute difference between any 2 adjacent elements must be less than or equal to 1. In other words, abs(arr[i] - arr[i - 1]) <= 1 for each i where 1 <= i < arr....

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

98. Validate Binary Search Tree

98. Validate Binary Search Tree Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node’s key. The right subtree of a node contains only nodes with keys greater than the node’s key. Both the left and right subtrees must also be binary search trees....

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

211. Design Add and Search Words Data Structure

211. Design Add and Search Words Data Structure Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: WordDictionary() Initializes the object. void addWord(word) Adds word to the data structure, it can be matched later. bool search(word) Returns true if there is any string in the data structure that - matches word or false otherwise. word may contain dots ‘....

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

535. Encode and Decode TinyURL

535. Encode and Decode TinyURL Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk. Design a class to encode a URL and decode a tiny URL. There is no restriction on how your encode/decode algorithm should work. You just need to ensure that a URL can be encoded to a tiny URL and the tiny URL can be decoded to the original URL....

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

567. Permutation in String

567. Permutation in String Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string’s permutations is the substring of the second string. 1 2 3 4 5 Example 1: Input: s1 = "ab" s2 = "eidbaooo" Output: True Explanation: s2 contains one permutation of s1 ("ba"). 1 2 3 4 Example 2: Input:s1= "ab" s2 = "eidboaoo" Output: False Constraints:...

<span title='2021-04-27 00:00:00 +0000 UTC'>April 27, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

1016. Binary String With Substrings Representing 1 To N

1016. Binary String With Substrings Representing 1 To N Given a binary string S (a string consisting only of ‘0’ and ‘1’s) and a positive integer N, return true if and only if for every integer X from 1 to N, the binary representation of X is a substring of S. 1 2 3 4 Example 1: Input: S = "0110", N = 3 Output: true 1 2 3 4 Example 2: Input: S = "0110", N = 4 Output: false Note:...

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

1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance

1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional and weighted edge between cities fromi and toi, and given the integer distanceThreshold. Return the city with the smallest number of cities that are reachable through some path and whose distance is at most distanceThreshold, If there are multiple such cities, return the city with the greatest number....

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

1631. Path With Minimum Effort

1631. Path With Minimum Effort You are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the height of cell (row, col). You are situated in the top-left cell, (0, 0), and you hope to travel to the bottom-right cell, (rows-1, columns-1) (i.e., 0-indexed). You can move up, down, left, or right, and you wish to find a route that requires the minimum effort....

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