Skip to content
Mission Peace edited this page Apr 3, 2016 · 280 revisions

##Contact Info## Contact me on IRC channel if you have a question. Server: irc.foonetic.net Channel: #tusharroy

###Facebook Page### Like my Facebook page for updates on new video. https://www.facebook.com/tusharroy25

###Private Tutoring### If you are interested in one on one private online tutoring from author of this github repository, please send email to mission.peace.tutoring@gmail.com

###Contribution to this repository### Please contribute to this repository to help it make better. Any change like new question, code improvement, doc improvement etc. is very welcome. Just send me a pull request and I will review the request and approve it if it looks good.

###Video Link###

  1. [Youtube channel] (https://www.youtube.com/user/tusharroy2525)
  2. Dynamic Programming Youtube playlist
  3. Binary Tree Youtube playlist
  4. Stack Queue Youtube playlist
  5. Suffix/Prefix Youtube playlist
  6. Graph Youtube playlist

###Topics###

  1. Arrays
  2. Binary Search
  3. Bits
  4. Dynamic Programming

###Dynamic Programming### ###Graph###

  1. A vertex in an undirected connected graph is an articulation point (or cut vertex) iff removing it (and edges through it) disconnects the graph. ArticulationPoint.java
  2. Find shortest path from one vertex to all vertex using bellman ford algorithm - BellmanFordShortestPath.java
  3. Binary max heap - BinaryMaxHeap.java
  4. Binary min heap - BinaryMinHeap.java
  5. A Bipartite Graph is a graph whose vertices can be divided into two independent sets, U and V such that every edge (u, v) either connects a vertex from U to V or a vertex from V to U - BiparteGraph.java
  6. Design a game of boggle - Boggle.java
  7. An edge in an undirected connected graph is a bridge iff removing it disconnects the graph. Given a graph find all bridges in this graph - Bridge.java
  8. Given two words of equal length convert first word to second word in such a way that all intermediate words are in dictionary - ConvertOneWordToAnother.java
  9. Find cycle in directed graph - CycleInDirectedGraph.java
  10. Find cycle in undirected graph - CycleUndirectedGraph.java
  11. Given a directed acyclic graph(DAG) find shortest path from one vertex to all vertices - DAGShortestPathTopological.java
  12. Given a graph with weighted edges, find shortest path from one vertex to all vertices - DijkstraShortestPath.java
  13. Given a directed graph, return true if you can reach every node of graph from any node else false - DirectedGraphConnectivity.java
  14. Given a graph, tell if it is eulirian, semi eulirian or non eulirian - EulerianPathAndCircuit.java
  15. Given a 2D matrix of Xs and Os, convert all Os to Xs if it is surrounded by Xs - FillOsWIthXsIfSurroundedByXs.java
  16. Flood fill algorithm - FloodFillAlgorithm.java
  17. All pair shortest path using flyod warshall algorithm - FloydWarshallAllPairShortestPath.java
  18. Given a directed graph with source and end point, find maximum flow from source to end - FordFulkerson.java
  19. Graph basic data structure - Graph.java
  20. Given a graph, color each vertex such that neighboring vertex does not have same color - GraphColoring.java
  21. BSF and DFS graph traversal - GraphTraversal.java
  22. Given a graph, find hamiltonian cycle in the graph if it exists. Hamiltonian cycle in undirected graph starts and ends at same point and traverses each vertex exactly once - HamiltonianCycle.java
  23. Find minimum spanning tree using Krushkal's algorithm - KrushkalMST.java
  24. A matching in a Bipartite Graph is a set of the edges chosen in such a way that no two edges share an endpoint - MaximumBiparteMatching.java
  25. Given a graph of 0s and 1s, find total number of islands of 1s - NumberOfIsland.java
  26. Given a graph, find total number of triangles in the graph - NumberofTriangles.java
  27. Prim's algorithm for minimum spanning tree - PrimMST.java
  28. Print all paths from source to destination in undirected graph - PrintAllPathFromSourceToDestination.java
  29. Given a directed graph, find strongly connected components of the graph - StronglyConnectedComponent.java
  30. Given a directed acyclic graph, sort is topologically - TopologicalSort.java
  31. Given a directed graph, find out if a vertex j is reachable from another vertex i for all vertex pairs (i, j) in the given graph - TransitiveClosure.java
  32. Clone directed graph - CloneDirectedGraph.java
  33. Disjoint set using path compression and union by rank DisjointSet.java
  34. Given a 2D floor plan of empty spaces, walls and multiple exits. Find distance of every empty space to closest exit. ShortestDistanceFromExit.java
  35. Tarjan's strongly connected component - TarjanStronglyConnectedComponent.java
  36. Tarjan's algorithm to find all simple cycles in directed graph - AllCyclesInDirectedGraphTarjan.java
  37. Johnson's algorithm for finding all cycles in directed graph - AllCyclesInDirectedGraphJohnson.java
  38. Traveling salesman problem using Held Karp Dynamic programming method - TravelingSalesmanHeldKarp.java
  39. Given a graph representing tree find minimum height tree - MinimumHeightTree.java

###LinkList###

  1. Add two numbers represented by link list - AddNumberRepresentedByLinkList.java
  2. Create a copy of a link list in which one pointer points to next node while other pointer can point to any node in the list - CopyLinkListWIthArbitPointer.java
  3. Given a linklist, delete m nodes after every n nodes - DeleteNAfterMNodes.java
  4. Delete nodes which has greater value on right side - DeleteNodeWithGreaterValueOnRight.java
  5. Given a linklist in which down pointer could point to another linklist and this happens recursively, flatten this linklist - FlattenLinkList.java
  6. Implement a LRU cache using linklist and map - LRUCache.java
  7. Basic link list structure - LinkList.java
  8. Sort linklist using merge sort - MergeSortLinkList.java
  9. Quick sort linklist - QuickSortSingleLinkList.java
  10. Remove duplicates from a sorted linklist - RemoveDuplicatesSortedList.java
  11. Given a linklist and k,reverse alternate k nodes in the linklist - ReverseAlternateKNodes.java
  12. Given a linklist, reverse alternate nodes and append it at the end - ReverseAlternateNodeAndAppendAtEnd.java
  13. Reverse every k nodes in a linklist - ReverseKNodes.java
  14. Sort a nearly sorted linklist - SortNearlySortedList.java
  15. Insert into sorted circular linklist - SortedCircularLinkList.java
  16. Given a sorted linklist, convert it into a balanced binary search tree - SortedLLToBalancedBST.java
  17. Stack with also support find/delete middle operation - StackWithLinkListMiddleOperation.java
  18. Given three linklist and a sum, find a triplet from each list which adds up to sum - TripletToSumInLinkList.java
  19. Insertion sort for link list - InsertionSortLinkList.java
  20. Double link list - DoubleLinkList.java
  21. Given two nodes of double link list swap them - SwapTwoNodesInDoubleLL.java
  22. Given a linklist, return true if elements form a palindrome or not - LinkListIsPalindrome.java
  23. Multiply two numbers given in form of linklist. Result should also be linklist - MultiplyTwoNumbersLinkList.java
  24. Convert linklist to complete binary tree - LinkListToCompleteBinaryTree.java
  25. Given a linklist, find middle element of the linklist - MiddleElementOfLinkList.java
  26. Shuffle merge linklist - ShuffleMerge.java
  27. Given a linked list of co-ordinates where adjacent points either form a vertical line or a horizontal line. Delete points from the linked list which are in the middle of a horizontal or vertical line.RemoveMiddleElementsOfLineSegment.java
  28. Find if there is a loop in linklist LoopInLinkList.java
  29. Given two sorted linked lists, construct a linked list that contains maximum sum path from start to end. The result list may contain nodes from both input lists. MergeForLargestSum.java

###Multi Array###

  1. Given a boolean matrix mat[M][N] of size M X N, modify it such that if a matrix cell mat[i][j] is 1 (or true) then make all the cells of ith row and jth column as 1 - Fill2DMatrixWith1.java
  2. Design game of life - GameOfLife.java
  3. Find the length of the longest chain of consecutive integers in an unsorted 2D square array (non-diagonal) - LongestConsecutiveIntegerInUnsorted2DArray.java
  4. Given a 2D array, create a new 2D array which joins first row elements with every other element from second row onwards - MatrixCalculation.java
  5. Given a 2D array, find sum of all rectangular and square sub matrix - MatrixFindAllSubSquareRectangleMatrix.java
  6. Print a 2D array in diagonal format - MatrixInDiagonalOrder.java
  7. Create a 2D array of alternating Xs and 0s rectangles - MatrixOf0sAnd1s.java
  8. Move in 2D array as per cell value - MoveCellPerCellValue.java
  9. Turn image by 90 degree - TurnImageBy90.java
  10. Given a n by n board where n is of form 2k where k >= 1 (Basically n is a power of 2 with minimum value as 2). The board has one missing cell (of size 1 x 1). Fill the board using L shaped tiles. TilingProblem.java
  11. Print matrix in spiral way - SpiralPrinting.java

###Numbers###

  1. Given a large number tell where it is an aggregate number or not - AggregateNumber.java
  2. Given an array of sorted numbers, tell if there are 3 numbers which form arithmetic progression - ArithemeticProgressionExists.java
  3. Given two numbers in form of an array, multiply them - ArrayMultiplication.java
  4. Given a number n and k, find binomial coefficient of n to k - BinomialCoefficient.java
  5. Covert a decimal number into any other base N < 10 - ConvertToBaseN.java
  6. Given a number n, find counts of 2 from 1 to n - CountNoOf2s.java
  7. Given a number n, find number of numbers which does not have digit 4 in them - CountNumbersNotIncluding4.java
  8. Given a dividend and a divisor, return remainder and quotient - DivisionWithoutDivisionOperator.java
  9. Given two numbers find their GCD(greatest common divisor) - EuclideanAlgoForGCD.java
  10. Given an array of numbers, generate a signature where D represent decrease and I represents increase. Now given Ds and Is generate pattern of number - GenerateSignature.java
  11. Given an array, find elements combining which forms largest multiple of 3 - https://github.com/mission-peace/interview/blob/master/src/com/interview/number/LargestMultipleOf3inArray.java
  12. Given a number n, tell if this number is a lucky number - LuckyNumbers.java
  13. Given an array of 3 numbers, find their median - https://github.com/mission-peace/interview/blob/master/src/com/interview/number/MedianOf3Number.java
  14. Write a program to determine whether n/2 distinctinctive pairs can be formed from given n integers where n is even and each pair's sum is divisible by given k - NBy2PairSumToK.java
  15. Given an array representing a number, find next larger palindrome which can be formed - NextLargestPalindrome.java
  16. Given a chinese number which never has 4, convert it into decimal format - NotIncluding4.java
  17. Given an array representing a number, return a new array consisting of same numbers but larger than this number - PermutationBiggerThanNumber.java
  18. Given two arrays representing numbers, convert first array into number which is next larger than second array - PermutationLargerThanGivenArray.java
  19. Calculate power function using divide and conquer - PowerFunction.java
  20. Given an array of numbers, arrange them in a way that yields the largest value - RearrangeNumberInArrayToFormLargestNumber.java
  21. Russian peasant multiplication - RussianPeasantMultiplication.java
  22. Smallest number greater than given number but all digits in increasing order - SmallestNumberGreaterThanGiveNumberIncreasingSequence.java
  23. Calculate square root of a number without using any library - SquareRoot.java
  24. Given a positive integer n, generate all possible unique ways to represent n as sum of positive integers -https://github.com/mission-peace/interview/blob/master/src/com/interview/number/UniquePartitionOfInteger.java
  25. A man is walking up a set of stairs. He can either take 1 or 2 steps at a time. Given n number of steps,find out how many combinations of steps he can take to reach the top of the stairs - NumberOfCombinationsForStairs.java
  26. Given a number, find number of trailing zeros in the factorial of this number - Trailing0sinFactorial.java
  27. Factorial of a large number - FactorialOfLargeNumber
  28. Find mth number in array of [1..n] where m is defined by lexicographically order - MthNumberInNSizeArray.java

###Tree###

  1. Self balancing tree AVL tree - AVLTree.java
  2. Given an arbitrary binary tree, convert it to a binary tree that holds Children Sum Property. You can only increment data values in any node - ArbitaryTreeToChildSumTree.java
  3. Given Preorder traversal of a BST, check if each non-leaf node has only one child. Assume that the BST contains unique entries - BSTOneChildPreOrderTraversal.java
  4. Btree implementation - BTree.java
  5. Binary tree operations - BinaryTree.java
  6. Convert a binary tree to circular link list - BinaryTreeToCircularLinkList.java
  7. Write a function to connect all the adjacent nodes at the same level in a binary tree - ConnectNodesAtSameLevel.java
  8. Given two arrays that represent preorder and postorder traversals of a full binary tree, construct the binary tree - ConstructFullTreeFromPreOrderPostOrder.java
  9. Construct tree from preorder and inorder traversal - ConstructTreeFromInOrderPreOrder.java
  10. Given inorder and level-order traversals of a Binary Tree, construct the Binary Tree - ConstructTreeFromLevelOrderInOrder.java
  11. Write a function to count number of smaller elements on right of each element in an array - CountNumberOfSmallerElementOnRight.java
  12. Given binary tree and two nodes, tell if these two nodes are cousins of each other or not - CousinNodes.java
  13. Diameter of binary tree - DiameterOfTree.java
  14. Huffman encoding - HuffmanEncoding.java
  15. Given two arrays which represent a sequence of keys. Imagine we make a Binary Search Tree (BST) from each array. We need to tell whether two BSTs will be identical or not without actually constructing the tree - IdenticalTrees.java
  16. Given a binary tree, find largest BST in this binary tree - LargestBSTInBinaryTree.java
  17. Given a Binary Tree, find size of the Largest Independent Set(LIS) in it. A subset of all tree nodes is an independent set if there is no edge between any two nodes of the subset - LargestIndependentSetInTree.java
  18. Level order traversal of binary tree - LevelOrderTraversal.java
  19. Create an iterator to traverse a binary tree. When the next function is called on the binary tree return the value at the next node as if you are doing an inorder traversal of the tree - NextInorderSuccessorIterator.java
  20. Given a binary tree and a number k, print nodes at distance k from given node - NodesAtDistanceK.java
  21. Populate inorder successor for all nodes - PopulateInOrderSuccessor.java
  22. Inorder successor of two tree -NextInorderSucessorOfTwoTree.java
  23. Given preorder traversal of a binary search tree, construct the BST - ConstructBSTFromPreOrderArray.java
  24. Print two BST in sorted form - PrintTwoBSTInSortedForm.java
  25. Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals the given number - RootToLeafToSum.java
  26. Range query segment tree - SegmentTree.java segmenttreesum.py
  27. Segment tree for minimum range query - SegmentTreeMinimumRangeQuery.java
  28. Given a binary tree with positive and negative numbers, sink negative numbers to the bottom of the tree - SinkNegativeToBottom.java
  29. Given an array that stores a complete Binary Search Tree, write a function that efficiently prints the given array in ascending order - SortedOrderPrintCompleteTreeArray.java
  30. Write a function that returns true if the given Binary Tree is SumTree else false. A SumTree is a Binary Tree where the value of a node is equal to sum of the nodes present in its left subtree and right subtree - SumTree.java
  31. Inorder,preorder,postorder traversals - TreeTraversals.java
  32. Given a binary tree, print it vertically - VerticalTreePrinting.java
  33. Given a Binary Search Tree (BST), modify it so that all greater values in the given BST are added to every node - AddGreaterValueNodeToEveryNode.java
  34. Print all nodes with no sibling - NodesWithNoSibling.java
  35. Boundary traversal of binary tree - BoundaryTraversal.java
  36. Convert a binary tree into double link list - BinaryTreeToDoubleLinkList.java
  37. Given a binary tree, tell if it is a complete tree or not. IsCompleteBinaryTree.java
  38. Given a preorder traversal of a tree with 0 or 2 children and char array where L stands for leaf node and N stands for inner node, create binary tree from it - ConstructTreeFromPreOrderTraversalWith0or2Child.java
  39. Convert a binary tree(not BST) to a sorted link list - BinaryTreeToSortedLinkList.java
  40. Given an inorder traversal of tree where each node is greater than its child nodes, create binary tree - ContructTreeFromInOrderTraversalRootGreaterThanChild.java
  41. Given two nodes value find lowest common ancestor of these two nodes - LowestCommonAncestorInBinaryTree.java
  42. Write a function to detect if two trees are isomorphic. Two trees are called isomorphic if one of them can be obtained from other by a series of flips - TreeIsomorphism.java
  43. Vertex cover for binary tree using DP - VertexCoverBinaryTreeDP.java
  44. Convert a binary tree(Not BST) to sorted linklist. DegenerateBinaryTreeToSortedLL
  45. Search in binary search tree - BSTSearch.java
  46. Given a binary tree, return true if is binary search tree else return false -IsBST.java
  47. Given two tree return true if they represent same tree else return false. SameTree.java
  48. Tree traversal in level and spiral order - TreeTraversalInSpiralOrder.java
  49. Tree traversal printing each level on new line - TreeTraversalLevelByLevel.java
  50. Level order traversal in reverse - LevelOrderTraversalInReverse.java
  51. Fenwick tree - FenwickTree.java
  52. Red black tree - RedBlackTree.java
  53. Given an preorder sequence determine if it is of binary search tree or not IsPreOrderArrayBST.java
  54. Succinct encoding/decoding of binary tree SuccinctTree.java
  55. Create binary tree from parent representation - BinaryTreeFromParentRepresentation.java
  56. Given pre/inorder traversal of binary tree, create post order traversal - PrintPostOrderFromPreOrderInOrder.java
  57. Construct all binary search tree from inorder traversal ConstructAllBinaryTreeFromInorderTraversal.java
  58. Interval tree IntervalTree.java
  59. Morris inorder/preorder traversal of tree - MorrisTraversal.java
  60. Serialize deserialize binary tree - SerializeDeserializeBinaryTree.java

###String###

  1. Given two strings tells if anagram of first is substring of another - AnagramOfFirstAsSubstring.java
  2. Cycle leader iteration - CycleLeaderIteration.java
  3. Given alternate digits and numbers, move them so that all digits are on one side and numbers on other side - InPlaceTransformationOfString.java
  4. Lexicographic rank of a string - LexicographicRankInPermutation.java
  5. Given a string, find longest palindromic substring in this string - LongestPalindromeSubstring.java
  6. Given a string find longest substring without repetition of characters - LongestSubstringWithoutRepetingCharacter.java
  7. Given an input string S write a function which returns true if it satisfies S = nT - NTMatch.java
  8. Given list of strings, print them in groups if they are anagrams of each other - PrintAnagramTogether.java
  9. Rabin karp substring search - RabinKarpSearch.java
  10. Given a string, rearrange characters in string so that characters are at least d distance away from repeated characters - RearrangeDuplicateCharsdDistanceAway.java
  11. Regex matching - RegexMatching.java
  12. Run length encoding - RunLengthEncoding.java
  13. Given two strings, find smallest window in first string which contains all characters of second string - SmallestWindowContaingAllCharacters.java
  14. KMP substring search - SubstringSearch.java
  15. Wild card searching - WildCardSearch.java
  16. Remove consecutive duplicate elements in character array - RemoveConsecutiveDuplicate.java
  17. Print all combinations of word abbreviation WordAbbreviationCombination.java

###Recursion###

  1. Generate all combination of size k and less of adjacent numbers - AllAdjacentCombination.java
  2. Generate all bracket combination, check if brackets open and closing is correct or not - Bracketology.java
  3. Given an array of strings, find if the given strings can be chained to form a circle. A string X can be put before another string Y in circle if the last character of X is same as first character of Y - ChainWordsToFormCircle.java
  4. Generate all combinations - Combination.java
  5. Generate all combination of size k - CombinationOfSizeK.java
  6. Generate all combination which prints star in place of absent characters - CombinationWithStar.java
  7. Consider a coding system for alphabets to integers where ‘a’ is represented as 1, ‘b’ as 2, .. ‘z’ as 26. Given an array of digits (1 to 9) as input, write a function that prints all valid interpretations of input array - InterpretationOfArray.java
  8. Generate all possible string combinations of a given phone number - KeyPadPermutation.java
  9. Minimum edits required to generate reverse polish notation - MinimumEditForReversePolishNotation.java
  10. Given a board of size nxn and n queens, place them on the board so that they don't attack each other - NQueenProblem.java
  11. Given two strings check if they are one distance away from each other where you can delete,edit or add characters - OneEditApart.java
  12. Print all paths from top left corner to bottom right corner - PrintAllPathFromTopLeftToBottomRight.java
  13. Given an array find number of interpretations possible for combinations of adjacent characters - PrintArrayInAdjacentWay.java
  14. Print array in tree fashion - PrintArrayInCustomizedFormat.java
  15. Permutation of string in both sorted and unsorted order - StringPermutation.java stringpermutation.py StringPermutationRotation.java
  16. Given two strings, generate all interleavings of these strings - StringInterleaving.java
  17. Shuffle a character array so that no two repeated characters are together. [FancyShuffle.java] (https://github.com/mission-peace/interview/blob/master/src/com/interview/recursion/FancyShuffle.java)
  18. Given an input and total, print all combinations with repetitions in this input which sums to given total. PrintSumCombination.java
  19. Given a List of List of Strings. Print cartesian product of List. WordCombination.java
  20. Given input of unique elements and pair among those elements. How many minimum swaps are needed to arrange pair adjacent to each other. SetPairTogether.java setpairtogether.py
  21. Given input string e.g 123 and target e.g 6, place operator +, - and * so that 123 evaluates to 6. OperatorAdditionForTarget.java
  22. Print all permutations of given input array - PrintAllSubsequence.java
  23. Reconstruct itinerary based on ticket - ReconstructItinerary.java
  24. Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results - RemoveInvalidParenthesis.java
  25. Sudoku solver - SudokuSolver.java

###Suffix/Prefix Tree###

  1. A suffix array is a sorted array of all suffixes of a given string. Given an array create suffix array for it - SuffixArray.java
  2. A ternary search tree is a special trie data structure where the child nodes of a standard trie are ordered as a binary search tree. Write a program to insert and search in ternary tree - TernaryTree.java
  3. Write a program to insert,search and delete in trie - Trie.java
  4. Ukkonen's suffix tree - SuffixTree.java
  5. Z algorithm for pattern matching ZAlgorithm.java

###Sorting###

  1. Counting sort - CountingSort.java
  2. Iterative quick sort - IterativeQuickSort.java
  3. Pancake sorting - PanCakeSorting.java
  4. Quick sort - QuickSort.java
  5. Radix sort - RadixSort.java
  6. Sort an array in range of 0 to N^3(or 0 to N^2) - Sort0toN3.java
  7. Sort an array by frequency of number in that array - SortArrayByFrequence.java
  8. Merge sort MergeSort.java
  9. Heap sort HeapSort.java

###Multithreading### 2. Executor service example - ThreadPoolExample.java 3. Thread pool implementation - ThreadPoolImpl.java 4. Given a queue which gets millions of messages. Message is of form <Domain,Update>.You have 10000 domain tables. Also you have 50 worker threads. You can only get data from front of the queue. Threads get data from the front and then update the domain table - SingleQueueDomainTableUpdate.java 4. Design a spinlock mutex using two varialbles - SpinLockMutex.java 5. Design threadsafe real time counter - RealTimeCounter.java 6. Design threadsafe program to keep counts of word - CountingWord.java 7. Fill up 2D boolean matrix in thread safe way from top left to bottom right - FillupMatrix.java 8. Design threadsafe program to keep min and max - MinMaxKeeper.java 9. BoundedBlockingQueue implementation(producer consumer) - BoundedBlockingQueue.java

###Regex###

  1. Given a sentence with multiple spaces between words and also spaces in front and back of sentence how do you remove these extra spaces - MultiSpaceReplacement.java

###Randomization###

  1. Given a method to generate random number between 1 to 5, create a new method to generate random number between 1 to 7 - Rand7UsingRand5.java
  2. Given a list of countries with population, how do you select random country from this list. Higher the population higher the probability of selection - RandomCountrySelectionByPopluation.java
  3. Reservior sampling algorithm. In stream of numbers select k random numbers - SelectMRandomNumbersInStream.java
  4. Given an array shuffle it - ShuffleArray.java

###Stack Queues###

  1. Implement a circular queue using an array of fixed size - CircularQueue.java
  2. Find maximum size rectangle in histogram - MaximumHistogram.java
  3. Move from current folder to new folder as specified in argument - MoveFromCurrentToNewFolder.java
  4. Reverse stack using recursion - ReverseStackUsingRecursion.java
  5. Given a string with unbalanced brackets how do you remove minimum number of extra brackets so that you are left with balanced brackets in the string - RemoveExtraBrackets.java
  6. Remove duplicates from a string while maintaining order and getting lexicographically smallest string - RemoveDuplicateMaintainingOrder.java
  7. Find median in stream of numbers - MedianFinder.java

###Geometry###

  1. Given points with x and y coordinates. Find distance between closest pair of points among the given points. ClosestPairOfPoints.java
  2. Given skyline of city with overlapping buildings. Merge the buildings. SkylineDrawing.java
    skylinedrawing.py
  3. Given n points on a 2D plane, find the maximum number of points that lie on the same straight line - MaximumPointsOnSameLine.java

###Misc###

  1. Given two sets of intervals. Ranges in the same set do not overlap each other. Merge these sets - AddingTwoSetOfIntervals.java
  2. Given a time(hour and min), find angle between hour and min hand - AngleBetweenHourAndMinuteHand.java
  3. Given an excel sheet kind of numbering, convert it into decimal and vice versa - ConvertNumberIntoBase26.java
  4. Given two dates in AD, find number of days between these 2 dates - DayDifferenceBetweenTwoDates.java
  5. Given a floating point number in string, convert it into actual float number - FloatPointConversion.java
  6. Given an array, find hamming distance between each pair of numbers in the array - HammingDistanceBetweenPair.java
  7. Given horizons of building in form of height and start end point, merge them into single horizon - HorizonMapping.java
  8. kth largest element in row wise and column wise sorted 2D array - KthLargestInRowiseColumnWiseSorted2DArray.java
  9. Design a load balancer where you can add,remove and find random server in O(1) time - LoadBalancers.java
  10. Given an integer, return a string which represents this integer in words - NumberToWord.java
  11. Convert a roman number into decimal number and vice versa - RomanNumberToDecimal.java
  12. Given cordinates of four points, say if they will form a square or not - FourPointsFormSquare.java
  13. Given two times in 4 digit number, find difference between them - DifferenceBetweenTwoTime.java
  14. All prime numbers before n - PrimeNumbersBeforeN.java
  15. How to give minimum number of candies to children with ratings. Every child with higher rating should get more candy then its neighbor with lower rating. Everyone should get at least one candy. CandiesProblem
  16. Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive - CountRanges.java
  17. Given a read function which supports reading only 4 bytes implement a reader which can read bytes of given size - Read4Function.java
  18. Insert interval into sorted intervals and merge if needed - InsertInterval.java
Clone this wiki locally