Twilio Interview Questions
Showing 13 questions
Given an array of numbers, rearrange it to maximize the number of indices where array[i] < rearranged_array[i]. Essentially, you want to maximize how many numbers in the array can be replaced by a strictly larger number from within the same array.
#1. Maximize Greatness of an Array
Determine if a binary tree is univalued, meaning every node has the same value. You need to check if all nodes in the tree contain the same value.
#2. Univalued Binary Tree
You're given a date string in a specific format (e.g., "20th Oct 2052") and need to convert it to a standardized format (YYYY-MM-DD).
#3. Reformat Date
Find the k most frequent elements in a given array of numbers. Return the top k elements based on their frequency.
#4. Top K Frequent Elements
You're given an array of numbers. Find how many ways you can remove a single element to make the sums of the even-indexed and odd-indexed elements equal.
#5. Ways to Make a Fair Array
You're given a list of flight tickets, each representing a departure and arrival airport. Reconstruct the itinerary by visiting all the airports in the lexicographically smallest order, starting from "JFK".
#6. Reconstruct Itinerary
You are given an array of strings. Determine how many strings within given ranges start and end with a vowel.
#7. Count Vowel Strings in Ranges
Given a sequence of words and a line width, format the text to fit within the specified width. You must justify the text, distributing extra spaces evenly between words.
#8. Text Justification
Given a list of words, group together all the anagrams. Anagrams are words that contain the same letters rearranged.
#9. Group Anagrams
Given a string of digits, return all possible letter combinations that the number could represent, using the typical phone keypad mapping. The goal is to generate all valid combinations in any order.
#10. Letter Combinations of a Phone Number
Determine if a string matches a pattern containing wildcard characters '?' (matches any single character) and '*' (matches any sequence of characters, including the empty sequence).
#11. Wildcard Matching
Determine the fewest swaps needed to balance a string containing only '[' and ']' characters. A balanced string has an equal number of opening and closing brackets correctly nested.
#12. Minimum Number of Swaps to Make the String Balanced
You're given two arrays that contain zeros. Replace the zeros in each array with positive integers to maximize the chance of making the two arrays have equal sums. Find the minimum equal sum achievable or determine if it's impossible.
#13. Minimum Equal Sum of Two Arrays After Replacing Zeros