Coding Exercise Posts - page 35 of 43

Recent posts

K Prefix

1 minute read

Given a list of integers nums and an integer k, return the maximum possible i where nums[0] + nums[1] + ... + nums[i] ≤ k. Return -1 if no valid i exists.

K Numbers Greater Than or Equal to K

less than 1 minute read

You are given a list of non-negative integers nums. If there are exactly k numbers in nums that are greater than or equal to k, return k. Otherwise, return -1.

K Longest Show Durations

1 minute read

Given a list of strings shows, a list of integers durations, and an integer k, where shows[i] and durations[i] represent the name and duration watched by the...

K and -K

less than 1 minute read

Given a list of integers nums, return the largest integer k where k and -k both exist in nums (they can be the same integer). If there’s no such integer, ret...

Just Average

1 minute read

Given a list of integers nums and an integer k, return true if you can remove exactly one element from the list to make the average equal to exactly k.

Invert Tree

less than 1 minute read

Given a binary tree root, invert it so that its left subtree and right subtree are swapped and the children are recursively inverted.

Inverse Factorial

less than 1 minute read

The factorial of a number n is defined as n! = n * (n - 1) * (n - 2) * ... * 1.

Intervals Intersecting at Point

less than 1 minute read

You are given a two-dimensional list of integers intervals and an integer point. Each element contains [start, end] represents an inclusive interval.

Interval Overlaps

less than 1 minute read

You are given a list of closed intervals l0 and another list of intervals l1. Individually, each list is non-overlapping and are sorted in ascending order.

Interval Intersection

1 minute read

Given a two-dimensional integer list intervals of the form [start, end] representing intervals (inclusive), return their intersection, that is, the interval ...

Interleaved String

less than 1 minute read

Given two strings s0 and s1, return the two strings interleaved, starting with s0. If there are leftover characters in a string they should be added to the e...