Balanced Meals
This question is asked by Apple. You are serving people in a lunch line and need to ensure each person gets a "balanced" meal. A balanced meal is a meal where there exists the same number of food items as drink items. Someone is helping you prepare the meals and hands you food items (i.e. F) or a drink items (D) in the order specified by the items string. Return the maximum number of balanced meals you are able to create without being able to modify items.
Can Construct Passage
This question is asked by Amazon. Given two strings, passage and text, return whether or not the characters in text can be used to form the given passage.
Decode Ways
This question is asked by Microsoft. Given a message that is encoded using the following encryption method:
Defanging IP Address
This question is asked by Amazon. Given a valid IP address, defang it.
Edit Distance (Levenshtein Distance)
This question is asked by Google. Given two strings s and t, return the minimum number of operations needed to convert s into t where a single operation consists of inserting a character, deleting a character, or replacing a character.
Find First Occurrence in String
Given two strings s and t, return the index of the first occurrence of t within s if it exists; otherwise, return -1.
Generate Parentheses
This question is asked by Facebook. Given an integer N, where N represents the number of pairs of parentheses (i.e. "(" and ")") you are given, return a list containing all possible well-formed parentheses you can create.
Implement Trie (Prefix Tree)
This question is asked by Microsoft. Implement a trie class that supports insertion and search functionalities.
Is Subsequence
This question is asked by Google. Given two strings s and t, return whether or not s is a subsequence of t.
Keyboard Row
Given a list of words, return all the words that require only a single row of a keyboard to type.
Length of Last Word
Given a string s, return the length of the last word.
Letter Case Permutation
This question is asked by Amazon. Given a string s consisting of only letters and digits, where we are allowed to transform any letter to uppercase or lowercase, return a list containing all possible permutations of the string.
Letter Combinations of a Phone Number
This question is asked by Google. Given a string of digits, return all possible text messages those digits could send.
Longest Common Subsequence
This question is asked by Google. Given two strings, s and t, return the length of their longest subsequence.
Longest Substring with At Most Two Distinct Characters
Given a string s, return the length of the longest substring containing at most two distinct characters.
Longest Substring Without Repeating Characters
Given a string s, return the length of the longest substring that contains only unique characters.
Maximum Length of Concatenated String with Unique Characters
Given an array of words, return the length of the longest phrase, containing only unique characters, that you can form by combining the given words together.
Palindrome Check
Given a string s, return true if it is a palindrome, and false otherwise. Ignore non-alphanumeric characters and case.
Palindrome Partitioning
This question is asked by Google. Given a string s, return all possible partitions of s such that each substring is a palindrome.
Partition Labels
Given a string s containing only lowercase characters, return a list of integers representing the size of each substring you can create such that each character in s only appears in one substring.
Remove Invalid Parentheses
Given a string s, remove the minimum number of parentheses to make s valid. Return all possible results.
Remove Vowels from String
This question is asked by Amazon. Given a string s, remove all the vowels it contains and return the resulting string.
Reorganize String
This question is asked by Facebook. Given a string, check if it can be modified such that no two adjacent characters are the same. If it is possible, return any string that satisfies this condition and if it is not possible return an empty string.
Repeated 10 Character Substrings
Given a string s, return all of its repeated 10 character substrings.
Reverse Vowels of a String
This question is asked by Facebook. Given a string, reverse the vowels of it.
Reverse Words in a String
Given a string s, reverse the words.
Shortest Distance to Character
Given a string s and a character c, return an array of integers where each index is the shortest distance from the character at that position to the nearest occurrence of c in the string.
String Compression
This question is asked by Facebook. Given a character array, compress it in place and return the new length of the array.
Top K Frequent Words
Given a list of words, return the top k frequently occurring words.
Word Break
This question is asked by Amazon. Given a string s and a list of words representing a dictionary, return whether or not the entirety of s can be segmented into dictionary words.
Word Pattern
Given a string s and a string code, return whether or not s could have been encrypted using the pattern represented in code.