Coding Exercise Posts - page 4 of 43

Recent posts

Repeated Deletion Sequel

less than 1 minute read

Given a string s and an integer k, repeatedly delete the earliest k consecutive duplicate characters.

Cut Ribbons of Same Length

1 minute read

You are given a list of positive integers ribbons and an integer k. Given that you can cut the ribbons as many times as you want, return the largest r such t...

Count Rectangular Submatrices

less than 1 minute read

Given a two-dimensional list of integers matrix containing 1s and 0s, return the total number of submatrices with all 1 s.

Permute List to Make Largest Range Sum

1 minute read

You are given a list of integers nums and a two-dimensional list of integers ranges. Each element in ranges contains [i, j], meaning to sum the numbers in nu...

Surrounded Islands

less than 1 minute read

You are given a two-dimensional integer matrix matrix containing 1s and 0s. 1 represents land and 0 represents water. An island is a group of 1s that are nei...

Detecting an Odd Length Cycle

less than 1 minute read

Given an undirected graph as an adjacency list, return whether the graph has an odd length cycle.

Bipartite Graph

1 minute read

Given an undirected graph represented as an adjacency list, return whether the graph is bipartite.

Candy Race with Different Types

less than 1 minute read

You are given a list of integers candies and are playing a game against a friend. In each round, a person can remove any two consecutive candies with the sam...

Minimum Number of Contiguous K-Flips

1 minute read

You are given a list of integers nums containing 1s and 0s and an integer k. Consider an operation where we flip a sublist of length k such that all 1s becom...

Reverse an Inner Linked List

less than 1 minute read

Given a singly linked list node, and integers i and j, reverse the linked list from i to jth nodes, 0 indexed and inclusive.