Showing 6 questions
You're given counts of 'A', 'B', and 'AB' strings. Combine them to construct the longest possible string where no two adjacent characters are the same.
#1. Construct the Longest New String
You're given a grid where some cells have stones and others are empty. Find the minimum number of moves to redistribute the stones so that each cell has exactly one stone.
#2. Minimum Moves to Spread Stones Over Grid
You're given a binary tree. Determine the minimum number of swaps needed at each level to sort the node values in ascending order.
#3. Minimum Number of Operations to Sort a Binary Tree by Level
You're given information about friend connections and watched videos. Find the videos watched by friends at a specific level in the social network, sorted by frequency and then alphabetically.
#4. Get Watched Videos by Your Friends
Given a sentence, rearrange and print each word vertically. Essentially, create a series of strings where each string represents a column of the original sentence.
#5. Print Words Vertically
Find the kth largest element in an unsorted array. Note that it is the kth largest element in sorted order, not the kth distinct element.
#6. Kth Largest Element in an Array