Coding Exercise Posts

Anagram Substrings

Given two strings s0 and s1, return the number of substrings where s1 contains any anagram of s0.

Separate People Given Dislike Relations

You are given an integer n and a two-dimensional list of integers enemies. Integer n means there’s n people labeled from [0, n - 1]. Each element in enemies ...

Fractional Knapsack

You are given two lists of integers weights and values which have the same length and an integer capacity. weights[i] and values[i] represent the weight and ...

Longest Arithmetic Subsequence with Difference Constraint

Given a list of integers nums and an integer diff, return the length of the longest arithmetic subsequence where the difference between each consecutive numb...

Maximum Sum Rectangle with Condition

Given a two-dimensional integer matrix matrix and an integer k, return the largest sum of a rectangle ≤ k.

Create Largest Number From a List

Given a list of integers nums, rearrange its order to form the largest possible integer and return it as a string.

Remove Duplicate Numbers

Given a list of integers nums, remove numbers that appear multiple times in the list, while maintaining order of the appearance in the original list.

Longest Increasing Path

Given a two-dimensional integer matrix, find the length of the longest strictly increasing path. You can move up, down, left, or right.

Longest Sublist with K Distinct Numbers

Given an integer k and a list of integers nums, return the length of the longest sublist that contains at most k distinct integers.

Anagram Partitioning

You are given two non-empty strings a and b that are the same length. Partition them into substrings such that each pair of a and b’s substring is the same s...