Skip to main content

31 docs tagged with "string"

View all tags

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:

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.

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.

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.

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.

Longest Common Subsequence

This question is asked by Google. Given two strings, s and t, return the length of their longest subsequence.

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.

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.

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.