Question bank
4,310 interview questions, answered.
Reference answers, what the interviewer is really testing, how it is graded, and the follow-ups that come next.
Easy 190Medium 2,498Hard 982
Filters · onDifficulty, topic, company
94 questions
- 49Write a function to balance parentheses in a given string by removing the fewest characters possible. Ensure that each opening parenthesis has a corresponding closing parenthesis and each pair is properly nested.MediumCoding·
Meta - 50Given a string with parentheses, write a function that removes the minimum number of characters to balance the parentheses.MediumCoding·
Meta - 51Given a binary tree, check if each node is the average of all descendantsMediumCoding·
Meta - 52Given the root of a binary tree, return the length of the diameter of the tree.MediumCoding·
Amazon, Google - 53Write a function that takes an array of integers and checks for duplicate values in any contiguous window of size N.MediumCoding·
Meta - 54Given a collection of rooms where Alibada is in one and moves one room a day to an adjacent room, write a program to determine if you can find Alibada with the given list of rooms.MediumCoding·
Meta - 55Given an array of integers and an integer k, find the kth largest element in the array.MediumCoding·
Meta, Microsoft - 56Find a local minima in an array Last UpdatedMediumCoding·
Meta - 57Find the equilibrium index in an array where sum of elements to the left is equal to sum of elements to the right.MediumCoding·
Meta - 58Given a list of strings, find all strings that encode to the same value using a Caesar Cipher. (A Caesar Cipher rotates characters, e.g. in CC3: a->d, b->e, ..., z->c)MediumCoding·
Meta, Pinterest - 59Explain how to find a target sum in an array.MediumCoding·
Adobe, Google - 60Given an array of numbers where every number occurs twice except one, how would you find the unique number in O(log n) time?MediumCoding·
Meta - 61Generate ParenthesesMediumCoding·
Adobe, Google - 62Implement a circular buffer.MediumCoding·
Meta - 63Implement the memcpy() function in C.MediumCoding·
Meta - 64Implement TrieMediumCoding·
Apple, Goldman Sachs - 65Find the largest perimeter of an island given a two-dimensional array of 1's and 0's representing land and water.MediumCoding·
Bloomberg, Meta - 66Find the lowest common ancestor (LCA) of two nodes in a binary tree.MediumCoding·
Apple, LinkedIn - 67Implement LRU Cache.HardCoding·
Accenture, Adobe - 68Merge k sorted linked lists.HardCoding·
Adobe, Apple - 69Move all zeros to the end of an array.EasyCoding·
Adobe, Amazon - 70Partition an array into two sub-arrays with equal sum.MediumCoding·
Apple, LinkedIn - 71Squares of sorted arrayMediumCoding·
Meta, PayPal - 72Calculate the trapped rainwater between bars in a given array.HardCoding·
Adobe, Amazon