Coding Exercise Posts - page 6 of 43

Recent posts

Sinking Islands

1 minute read

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...

Count Exact Sum

1 minute read

Given a list of positive integers nums and an integer k, return the number of subsets in the list that sum up to k.

Longest Zero Sublist Sum

less than 1 minute read

Given a list of integers nums, which contains either -1 or 1, return the length of the longest sublist that sums to 0.

Trie

1 minute read

Implement a trie data structure with the following methods:

Connect Cartesian Coordinates

1 minute read

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...

Distinct Substrings

less than 1 minute read

Given a string s, return the number of distinct non-empty substrings.

Sum Pairs to Target

1 minute read

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...

Longest 1s After One Flip

less than 1 minute read

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.

Equal Piles

less than 1 minute read

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.

Virtually Cloneable Stacks

1 minute read

Implement a data structure VirtuallyCloneableStacks with the following methods