Coding Exercise Posts

Recent posts

Anagram Substrings

less than 1 minute read

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

Separate People Given Dislike Relations

1 minute read

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

1 minute read

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

Maximum Sum Rectangle with Condition

less than 1 minute read

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

less than 1 minute read

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

Remove Duplicate Numbers

less than 1 minute read

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

less than 1 minute read

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

1 minute read

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

1 minute read

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

Making Change

less than 1 minute read

Find the minimum number of coins required to make n cents.

String Equivalence Relations

1 minute read

You are given three lowercase alphabet strings a, b and target. Strings a and b have the same length and are defined to be equivalent: a[i] = b[i]. For examp...