Amazon Topics for Interview Preparation
Easy LevelHow to check if given four points form a squareCheck if a string can be obtained by rotating another string 2 placesFind the nearest smaller numbers on left side in an arrayFind if two rectangles overlapPair with given product | Set 1 (Find if any pair exists)Position of rightmost set bitPrint all possible strings that can be made by placing spacesReplace all ‘0’ with ‘5’ in an input IntegerA Boolean Matrix QuestionAmazon Interview Experience | Set 315Array RotationProgram for array rotationBuild Lowest Number by Removing n digits from a given numberCalculate the angle between hour hand and minute handCheck if all bits of a number are setCheck if a given Binary Tree is SumTreeCheck if a number can be expressed as x^y (x raised to power y)Check if two trees are MirrorConverting Decimal Number lying between 1 to 3999 to Roman NumeralsCount 'd' digit positive integers with 0 as a digitCount number of bits to be flipped to convert A to BCount number of occurrences (or frequency) in a sorted arrayCount all possible groups of size 2 or 3 that have sum as multiple of 3Count all possible paths from top left to bottom right of a mXn matrixCount total set bits in all numbers from 1 to nCount triplets with sum smaller than a given valueCount words that appear exactly two times in an array of wordsDynamic Programming | Set 30 (Dice Throw)Equilibrium index of an arrayFill array with 1's using minimum iterations of filling neighborsFind a Fixed Point (Value equal to index) in a given arrayFind first and last occurrences of an element in a sorted arrayFind four elements that sum to a given value | Set 1 (n^3 solution)Find the index of first 1 in a sorted array of 0's and 1'sFind minimum difference between any two elementsCount the number of possible trianglesFind the Missing NumberFind the Number Occurring Odd Number of TimesFind two prime numbers with given sumFind uncommon characters of the two stringsGiven a binary tree, print all root-to-leaf pathsAn Interesting Method to Generate Binary Numbers from 1 to nk largest(or smallest) elements in an array | added Min Heap methodLevel Order Tree TraversalMaximum sum such that no two elements are adjacentMobile Numeric Keypad ProblemNumbers having Unique (or Distinct) digitsPosition of rightmost set bitPrint all nodes that don't have siblingQueue | Set 2 (Linked List Implementation)Rearrange positive and negative numbers in O(n) time and O(1) extra spaceRemove characters from the first string which are present in the second string
Remove minimum number of characters so that two strings become anagramReplace all ‘0’ with ‘5’ in an input IntegerFind a pair with maximum product in array of IntegersReverse an array upto a given positionRun Length EncodingSquare root of an integerTiling ProblemType of array and its maximum elementFind the middle of a given linked list in C and JavaWrite a Program to Find the Maximum Depth or Height of a TreeWrite a program to print all permutations of a given stringWrite your own atoi()A Product Array PuzzleAdd two numbers represented by linked lists | Set 1Backtracking | Set 1 (The Knight's tour problem)Binary Search Tree | Set 1 (Search and Insertion)Binary Tree to Binary Search Tree ConversionBoundary Traversal of binary treeBreadth First Traversal or BFS for a GraphCheck for balanced parentheses in an expressionCheck if a given array contains duplicate elements within k distance from each otherHow to check if given four points form a squareCheck if a given sequence of moves for a robot is circular or notExtract Leaves of a Binary Tree in a Doubly Linked ListConvert a given tree to its Sum TreeConvert array into Zig-Zag fashionConverting Roman Numerals to Decimal lying between 1 to 3999Count maximum points on same lineCount number of ways to cover a distanceCount numbers with same first and last digitsCount ways to reach the n'th stairCount Inversions in an array | Set 1 (Using Merge Sort)Delete N nodes after M nodes of a linked listDepth First Traversal or DFS for a GraphDesign a stack that supports getMin() in O(1) time and O(1) extra spaceDiameter of a Binary TreeDifference between sums of odd level and even level nodes of a Binary TreeDynamic Programming | Set 10 ( 0-1 Knapsack Problem)Dynamic Programming | Set 12 (Longest Palindromic Subsequence)Dynamic Programming | Set 14 (Maximum Sum Increasing Subsequence)Dynamic Programming | Set 17 (Palindrome Partitioning)Dynamic Programming | Set 18 (Partition problem)For each element in 1st array count elements less than or equal to it in 2nd arrayEquilibrium index of an arrayEvaluation of Expression TreeExtract maximum numeric value from a given string | Set 1 (General approach)Find a peak elementFind a sorted subsequence of size 3 in linear timeFind all strings that match specific pattern in a dictionaryFind an equal point in a string of bracketsFind Excel column name from a given column numberFind four elements a, b, c and d in an array such that a+b = c+dFind height of a special binary tree whose leaf nodes are connectedFind index of an extra element present in one sorted arrayFind maximum level sum in Binary TreeMaximum product of a triplet (subsequnece of size 3) in arrayFind the minimum element in a sorted and rotated arrayFind minimum number of coins that make a given valueFind next greater number with same set of digitsFind nth Magic NumberPrint all possible words from phone digitsPythagorean Triplet in an arrayFind the Rotation Count in Rotated Sorted arrayFind subarray with given sum | Set 1 (Nonnegative Numbers)Find the element before which all the elements are smFind the element that appears onceFind the largest subarray with 0 sumFind the maximum element in an array which is first increasing and then decreFind the maximum repeating number in O(n) time and O(1) extra spaceFind the row with maximum number of 1sFind the smallest positive number missing from an unsorted array | Set 1Find the smallest positive number missing from an unsorted arrayFind the smallest window in a string containing all characters of another strinFind top k (or most frequent) numbers in a streamFind the transition point in a binary arrayFind the two non-repeating elements in an array of repeating elementsFind zeroes to be flipped so that number of consecutive 1's is maximizedFloor in a Sorted ArrayFunction to check if a singly linked list is palindromeFind Next Sparse NumberGenerate n-bit Gray CodesGiven a string, find its first non-repeating characterGiven a binary string, count number of substrings that start and end with 1.Given only a pointer/reference to a node to be deleted in a singly linGiven two unsorted arrays, find all pairs whose sum is xGreedy Algorithms | Set 1 (Activity Selection Problem)Highest power of 2 less than or equal to given numberHow to determine if a binary tree is height-balanced?Sort a linked list that is sorted alternating ascending and descending ordeImplement Stack using QueuesIntersection of two Sorted Linked ListsLargest subarray with equal number of 0s and 1sLength of the longest substring without repeating charactersLevel order traversal in spiral formLongest consecutive sequence in Binary treeLook-and-Say SequenceLowest Common Ancestor in a Binary Tree | Set 1Lowest Common Ancestor in a Binary Search Tree.Majority ElementMaximize number of 0s by flipping a subarrayMaximize value of (arr[i] - i) - (arr[j] - j) in an arrayMaximum Product SubarrayMaximum sum of i*arr[i] among all rotations of a given arrayMaximum sum of lengths of non-overlapping subarrays with k as the max element.Maximum Sum Path in Two ArraysMaximum sum such that no two elements are adjacentMedian of two sorted arraysMerge two sorted linked listsMinimum sum of squares of character counts in a given string after removing k characterMinimum time required to rot all orangesModify contents of Linked ListMove all zeroes to end of arrayMultiply two numbers represented by Linked ListsNext Greater ElementFind n'th node from the end of a Linked ListProgram for n'th node from the end of a Linked ListNumber of buildings facing the sunNumber of Groups of Sizes Two Or Three Divisible By 3Number of paths with exactly k coinsPairwise swap elements of a given linked listPrint all Jumping Numbers smaller than or equal to a given valuePrint a Binary Tree in Vertical Order | Set 1Print Common Nodes in Two Binary Search TreesPrint K'th element in spiral form of matrixPrint Left View of a Binary TreePrint level order traversal line by linePrint nodes at k distance from rootPrint all nodes in a binary tree having K leavesPrint all possible strings that can be made by placing spacesPrint Right View of a Binary TreePrint unique rows in a given boolean matrixImplement Queue using StacksRearrange a linked list such that all even and odd positioned nodes are togetheRearrange characters in a string such that no two adjacent are sameRemove every k-th node of the linked listReplace every element with the greatest element on right sideReverse Level Order TraversalReverse words in a given stringRoot to leaf path sum equal to a given numberSearch an element in a sorted and rotated arraySegregate even and odd nodes in a Linked ListSerialize and Deserialize a Binary TreeSliding Window Maximum (Maximum of all subarrays of size k)Sort a linked list of 0s, 1s and 2sSort a stack using recursionSort an array of 0s, 1s and 2sSort linked list which is already sorted on absolute valuesSorted Array to Balanced BSTSorted insert for circular linked listStock Buy Sell to Maximize ProfitSubmatrix Sum QueriesThe Celebrity ProblemTrapping Rain WaterTree Isomorphism ProblemTwo elements whose sum is closest to zeroUnbounded Knapsack (Repetition of items allowed)Union and Intersection of two Linked ListsWrite a program function to detect loop in a linked listGiven an aWrite an Efficient C Program to Reverse Bits of a NumberWrite Code to Determine if Two Trees are IdenticalXOR of all subarray XORs
Medium LevelA program to check if a binary tree is BST or notAdd all greater values to every node in a given BSTAdding two polynomials using Linked ListBacktracking | Set 6 (Hamiltonian Cycle)Backtracking | Set 7 (Sudoku)Backtracking | Set 2 (Rat in a Maze)Binary HeapBinary Search Tree | Set 2 (Delete)Boggle | Set 2 (Using Trie)Bottom View of a Binary TreeHow to print maximum number of 'A' using given four keysClone a Binary Tree with Random PointersClone a linked list with next and random pointer | Set 2Combinational SumConnect n ropes with minimum costConnect nodes at same levelConstruct Binary Tree from given Parent Array representationConstruct a special tree from given preorder traversalProgram to convert a given number to wordsCount of n digit numbers whose sum of digits equals to given sumCount Possible Decodings of a given Digit SequenceCount ways to reach the n'th stairDelete nodes which have a greater value on right sideDelete all occurrences of a given key in a linked listDetect and Remove Loop in a Linked ListDetect Cycle in a Directed GraphDetect cycle in an undirected graphDiagonal Traversal of Binary TreeDynamic Programming | Set 11 (Egg Dropping Puzzle)Dynamic Programming | Set 20 (Maximum Length Chain of Pairs)Dynamic Programming | Set 22 (Box Stacking Problem)Dynamic Programming | Set 27 (Maximum sum rectangle in a 2D matrix)Dynamic Programming | Set 28 (Minimum insertions to form a palindrome)Dynamic Programming | Set 3 (Longest Increasing Subsequence)Dynamic Programming | Set 31 (Optimal Strategy for a Game)Dynamic Programming | Set 4 (Longest Common Subsequence)Dynamic Programming | Set 5 (Edit Distance)Find a pair with given sum in a Balanced BSTFind the first circular tour that visits all petrol pumpsFind a triplet that sum to a given valueFind distance between two given keys of a Binary TreeFind all distinct subsets of a given setFind the first non-repeating character from a stream of charactersFind four elements that sum to a given value | Set 2 ( O(n^2Logn) Solution)Find if a given string can be represented from a substring by iterating the substring “nFind k-th smallest element in BST (Order Statistics in BST)Find length of the largest region in Boolean MatrixFind next greater number with same set of digitsFind the number of islands | Set 1 (Using DFS)Find smallest range containing elements from k listsFind the largest BST subtree in a given Binary Tree | Set 1Find the largest BST subtree in a given Binary TreeProgram to find amount of water in a given glassFind whether there is path between two cells in matrixFlattening a Linked ListForm minimum number from given sequenceGiven a number, find the next smallest palindromeGiven a binary string, count number of substrings that start and end with 1.Construct Complete Binary Tree from its Linked List RepresentationGreedy Algorithms | Set 3 (Huffman Coding)Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST))How to print maximum number of A's using given four keysInorder Successor in Binary Search TreeInplace rotate square matrix by 90 degrees | Set 1Kth smallest element in a row-wise and column-wise sorted 2D array | Set 1Largest Rectangular Area in a Histogram | Set 2Largest Sum Contiguous SubarrayLength of the longest substring without repeating charactersLongest Consecutive SubsequenceMaximum difference between node and its ancestor in Binary TreeMaximum size rectangle binary sub-matrix with all 1sMaximum size square sub-matrix with all 1sMerge K sorted linked listsMerge two BSTs with limited extra spaceMerge Overlapping IntervalsMinimum number of jumps to reach endMinimum Number of Platforms Required for a Railway/Bus StationMinimum steps to reach a destinationNon-crossing lines to connect points in a circleNumber of non-negative integral solutions of a + b + c = nNumber of subsequences of the form a^i b^j c^kNuts & Bolts Problem (Lock & Key problem)Print extreme nodes of each level of Binary Tree in alternate orderPrint all k-sum paths in a binary treePrint leftmost and rightmost nodes of a Binary TreePrint Nodes in Top View of Binary TreePrinting brackets in Matrix Chain Multiplication ProblemRearrange characters in a string such that no two adjacent are sameRemove minimum elements from either side such that 2*min becomes more than maxSegment Tree | Set 1 (Sum of given range)Smallest window that contains all characters of string itselfSnake and Ladder ProblemSort an array according to the order defined by another arraySort an array in wave formStepping NumbersTopological SortingTotal number of possible Binary Search Trees with n keysTrapping Rain WaterValidity of a given Tic-Tac-Toe board configurationwildcard pattern matchingGiven an aWrite a function to get the intersection point of two Linked Lists.Write an Efficient Method to Check if a Number is Multiple of 3
Hard LevelAVL Tree | Set 1 (Insertion)AVL Tree | Set 2 (Deletion)Backtracking | Set 3 (N Queen Problem)Backtracking | Set 7 (Sudoku)Construct a Binary Tree from Postorder and InorderDynamic Programming | Set 37 (Boolean Parenthesization Problem)Find Recurring Sequence in a FractionFind maximum of minimum for every window size in a given arrayTwo nodes of a BST are swapped, correct the BSTGiven an array arr, find the maximum j - i such that arr[j] > arr[i]Arrange given numbers to form the biggest number | Set 1Arrange given numbers to form the biggest numberGiven a sorted dictionary of an alien language, find order of charactersImplement LRU CacheMedian in a stream of integers (running integers)Partition a set into two subsets such that the difference of subset sums is Rearrange a given linked list in-place.