Showing 6 questions
Compress a given string by replacing consecutive repeating characters with the character followed by the count of repetitions. If the compressed string isn't shorter, return the original.
#1. String Compression
You have a certain number of coins. Determine how many complete rows of coins you can form in a staircase shape, where each row has one more coin than the row above.
#2. Arranging Coins
You are given a collection of intervals. Merge all overlapping intervals into a single interval and return the result.
#3. Merge Intervals
Determine if a string containing parentheses is valid. A valid string has matching and properly nested opening and closing parentheses.
#4. Valid Parentheses
Given a collection of distinct integers, find all possible permutations (orderings) of the elements. Return a list of these permutations.
#5. Permutations
Find the minimum sum of degrees for any connected trio (three mutually connected nodes) in a graph. Essentially, you need to identify a triangle and calculate the sum of the degrees of its vertices.
#6. Minimum Degree of a Connected Trio in a Graph