Coding Exercise Posts - page 12 of 43

Recent posts

Longest Palindromic Subsequence

less than 1 minute read

Given a string s with all lower case characters, find the length of the longest palindromic subsequence in s.

Lexicographically Bigger String

1 minute read

Given lowercase alphabet strings s and t of the same length, return whether there’s some anagram of s, say a, and some anagram of t, say b, such that:

Find the Largest Number in a Rotated List

1 minute read

You are given a list of unique integers nums that is sorted in ascending order and is rotated at some pivot point. Find the maximum number in the rotated list.

Enlarge BST

less than 1 minute read

Given a binary search tree root, replace every node’s value v by its value plus the sum of all other values in the tree that are greater than v.

Unlock Rooms

1 minute read

You are given a two-dimensional list of integers rooms. Each index i in rooms represents a room and rooms[i] represents different keys to unlock other rooms.

The Auditor

less than 1 minute read

Spreadsheets often use this alphabetical encoding for its columns: "A", "B", "C", …, "AA", "AB", "AC", …, "ZZ", "AAA", "AAB", "AAC", ….

Split Tree to Maximize Product

less than 1 minute read

Given a binary tree root, consider deleting an edge in the tree so that the tree becomes disjoint with two trees. Then, take the sum of each subtree and mult...

Rod Cutting

1 minute read

You are given a list of integers prices where prices[i] represents the price to sell a rod of size i + 1, and an integer n which represents the current size ...

Most Frequent Subtree Sum

less than 1 minute read

Given a binary tree root, find the most frequent subtree sum. The subtree sum of a node is the sum of all values under a node, including the node itself. You...