3Sum
Given a list of integers, nums, return a list containing all triplets that sum to zero.
Given a list of integers, nums, return a list containing all triplets that sum to zero.
This question is asked by Amazon. You are at a birthday party and are asked to distribute cake to your guests. Each guest is only satisfied if the size of the piece of cake they're given matches their appetite (i.e., is greater than or equal to their appetite). Given two arrays, appetite and cake where the ith element of appetite represents the ith guest's appetite, and the elements of cake represents the sizes of cake you have to distribute, return the maximum number of guests that you can satisfy.
This question is asked by Amazon. A ship is about to set sail and you are responsible for its safety precautions. More specifically, you are responsible for determining how many life rafts to carry onboard. You are given a list of all the passengers' weights and are informed that a single life raft has a maximum capacity of limit and can hold at most two people. Return the minimum number of life rafts you must take onboard to ensure the safety of all your passengers.
You are building a pool in your backyard and want to create the largest pool possible. The largest pool is defined as the pool that holds the most water. The workers you hired to dig the hole for your pool didn't do a great job and because of this the depths of the pool at different areas are not equal. Given an integer array of non-negative integers that represents a histogram of the different heights at each position of the hole for your pool, return the largest pool you can create.
Given two strings s and t, return the index of the first occurrence of t within s if it exists; otherwise, return -1.
Given an integer n, return whether or not it is a "magical" number. A magical number is an integer such that when you repeatedly replace the number with the sum of the squares of its digits, it eventually becomes one.
This question is asked by Google. Given two strings s and t, return whether or not s is a subsequence of t.
Given a string s, return the length of the longest substring containing at most two distinct characters.
Given a string s, return the length of the longest substring that contains only unique characters.
This question is asked by Apple. Given an array of numbers, move all zeroes in the array to the end while maintaining the relative order of the other numbers.
Given a string s, return true if it is a palindrome, and false otherwise. Ignore non-alphanumeric characters and case.
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.
Given an integer array nums and a value val, remove all instances of val in-place and return the length of the new array.
This question is asked by Facebook. Given a string, reverse the vowels of it.
Given a string s, reverse the words.
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.
This question is asked by Amazon. Given an array of integers, nums, sort the array in any manner such that when i is even, nums[i] is even and when i is odd, nums[i] is odd.
This question is asked by Facebook. Given a character array, compress it in place and return the new length of the array.
Given the reference to the root of a binary search tree and a target value, return whether or not two individual values within the tree can sum to the target.