Sinking Islands
Given an 2D matrix of 0s and 1s, a 1 represents land and 0 represents water. An island is a group of 1’s that are surrounded by 0s or by the border. Find all...
Given an 2D matrix of 0s and 1s, a 1 represents land and 0 represents water. An island is a group of 1’s that are surrounded by 0s or by the border. Find all...
Implement a data structure with the following methods:
Given a string s, return the minimum number of characters needed to be inserted so that the string becomes a palindrome.
Given a list of positive integers nums and an integer k, return the number of subsets in the list that sum up to k.
Given a list of integers nums, which contains either -1 or 1, return the length of the longest sublist that sums to 0.
Implement a trie data structure with the following methods:
You are given a two-dimensional list of integers points where each element contains [x, y] representing a cartesian coordinate. We can make an undirected edg...
Given a string s, return the number of distinct non-empty substrings.
You are given a list of integers nums and an integer target. In one operation we can remove any two numbers in nums if the pair sums to target. Return the ma...
You are given a string s containing 1s and 0s. Given that you can flip at most one "0", return the length of the longest contiguous substring of 1s.
Given a list of integers nums, you can perform the following operation: pick the largest integer in nums and turn it into the second largest number.
Implement a data structure VirtuallyCloneableStacks with the following methods