Skip to content

harishvc/challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cracking the coding interview

Collection of interesting questions and solutions that involve data structures, algorithms and concepts. Solutions are in Python version 3.4.3

Table of Contents

Quick References

  1. Command Line Tools
  2. AWK
  3. Python3 πŸ‘
  4. MySQL
  5. JavaScript

Data Structures, Algorithms & Concepts

  1. Data structures, algorithms, time complexity and concepts πŸ‘ 🎢
  2. Introduction to Concurrency πŸ‘ 🎢
  3. Introduction to Design Pattern 🎢
  4. Introduction to Bit Manipulation πŸ’₯ 🎢
  5. Fun with Bits & Bytes πŸš€
  6. Fun with Permuation and Combination πŸ’₯ 🎢

Brain Teasers (Basic)

  1. Convert celsius to fahrenheit
  2. Find sum of all even numbers for a given range
  3. Find factorial of n
  4. Find square root of a number
  5. Find square root without using sqrt function
  6. Find power of a number
  7. Fibonacci series
    7.1 Find the Fibonacci numbers between the given range
    7.2 Find odd numbers in the Fibonacci series for a given range
  8. Write an "echo" program
  9. Number of perfect squares between two given numbers
  10. Find all possible numbers which multiply to a give number
  11. Can you fix an almost sorted list with one swap (such that the result is sorted)? 🎢

Brain Teasers (Moderate)

  1. Check if a given number is prime
  2. How many trailing zeros are in n! (n factorial) πŸ“
  3. Reverse an integer
  4. Find the Greatest Common Divisior (GCD) of two positive integers
  5. Validate Sudoku 🎨
  6. Flatten an object representation. Example {a:1, b:2, c:{d:3}} flattens to {a:1,b:2,c.d:3} πŸ’₯ πŸ‘
  7. Matrix
    7.1 Print the matrix from outside to inside (Spiral) πŸ’₯
    7.2 Given a two dimentional matrix where values are increasing. Search for a target value πŸ‘ 🎢
    7.3 Rotate a 2D matrix clockwise 90 degrees
    7.4 Rotate a 2D matrix anti-clockwise 90 degrees πŸ‘
  8. Number of perfect squares between two given numbers
  9. Find the coordinates of the rectangle in the 2 dimensional list [TODO]
  10. Check if a number is a happy number
  11. Given an integer and returns all possible combinations of its factors
  12. Given a digit string (from phone keypad), return all possible letter combinations that the number could represent

Permutations and Combinations

  1. References
    1. Introduction to Permutation and Combination πŸ’₯ πŸ‘
    2. Power set, Permutation, Combination πŸš€
  2. Compute all permutations of a string
  3. Find all possible combinations for a given string
  4. Compute all possible string combinations that can be made my placing spaces (zero or one) between them
  5. Given a string containing only digits, restore it by returning all possible valid IP address combinations
  6. Given a phone number provide possible letter mnemonics
  7. Can you create the given word from the dictionary? πŸ‘
  8. Given a set of characters and a positive integer k, print all possible strings of length k that can be formed πŸ‘
  9. Given a word and a dictionary. Find all possible words can you make that are found in the dictionary?
  10. Given a string and pattern with 1's and 0's find the minimum # of turn needed to make sure the pattern does not appear in the string πŸ‘

Bitwise Operations

  1. Introduction to bitwise operations
  2. Bitwise addition
  3. Bitwise subtraction
  4. Given a number n, check whether the number is a power of 2
  5. Given a number n, multiple the number by 2^k
  6. Compute n^k using bit operations πŸ’₯ πŸ‘
  7. Swap two variable values without additional space
  8. Write an efficient program to unset the right most bit and count number of 1s in binary representation of an integer
  9. Given a list of repeating integers find the lonely integer
  10. Generate rand7 using rand5 πŸ’‘

Sort

  1. Sorting Algorithms & Notes
    1.1 Quick Sort πŸ‘
    1.2 Quick Selection Sort πŸš€
    1.3 Merge Sort
    1.4 Heap Sort πŸš€ πŸ’₯
    1.5 Insertion Sort
    1.6 Bucket Sort
    1.7 Radix Sort
  2. Sort lists,lists of lists and list of dictionaries
  3. Sort a list of ones, twos and threes
  4. Given two sorted list merge them
  5. Merge sorted lists
  6. Sort version numbers πŸ“ πŸ’₯
  7. Median
    7.1 Find median of a sorted list
    7.2 Find median of two sorted list πŸ’‘ πŸ‘ πŸš€
    7.3 Find median of unsorted list πŸ’‘ 🎢
    7.4 Find median in a stream of integers (running median) πŸš€ 🎢 🎨
  8. Unsorted list of values
    8.1 Find the smallest K
    8.2 Find the largest K
  9. Merge K sorted list of size N 🎨 πŸ’‘
  10. Sort a string
  11. Find the first and second largest value in an unsorted list
  12. Given a sequence of words, print all anagrams together πŸ’‘
  13. Sort a string of printable characters πŸš€

Search

  1. Implement skip list
  2. Implement Trie - insert, search, searchWith, delete (Prefix Tree) 🎢 πŸ’‘
  3. Implement Bloom Filter πŸ’‘ πŸ’₯
  4. Implement Suffix Array 🎢 πŸ’‘
  5. Search using Regular Expression
  6. KMP (Knuth Morris Pratt) algorithm πŸ’₯ πŸš€
  7. Implement Z algorithm
  8. Find the missing number in an increasing sequence (1 ...N) πŸ’‘
  9. Given a list of integers with duplicates (can be more than one) find any integer than appears more than once
    9.1 Can modify the input list
    9.2 Cannot modify the input list
  10. Given unsorted values with several duplicates and one value that occurs once find the value TODO
  11. Find duplicates given 2 sorted lists
    11.1 both list of same size
    11.2 one list is >> other
  12. Given a two dimentional matrix where values are increasing. Search for a target value πŸ‘ 🎢
  13. Given a sorted list find if a value exists πŸ’₯

Lists & Dictionaries

  1. Randomize list elements
  2. Given two numbers as list add them and return result as list
  3. Say as you see - given an input string of integers print the output πŸ“
  4. Given a list of numbers, return a list of products of all other numbers without using division in O(n) time πŸ’‘ 🎢
  5. Design a dictionary that performs insert, lookup and delete in constant time O(1)
  6. Find the majority element πŸ’₯
    6.1 From unsorted list in linear time and constant storage πŸ‘
    6.2 From sorted list in logrithmic time and constant storage πŸ‘ πŸ’‘
  7. Two lists
    7.1 Find the intersection of two sorted lists πŸ“
    7.2 Given two lists, find a pair of values (one from each array) such that you can swap so that both arrays sum to the same value [TODO]
    7.3 Given two sorted list merge them
    7.4 Merge sorted lists
    7.5 Find min value of two unsorted lists πŸ’‘ πŸ‘
  8. Duplicates
    8.1 Given a list of integers return a list of integers that only occurred once πŸ’‘ πŸ“
    8.2 Given a sorted list, remove the duplicates in place, return modified list and #unique values 🎢
  9. Given a list and condition
    9.1 Find all possible 2 numbers in the list that add up to the given sum
    9.2 Find all possible triplets in the list that add up to the given sum
    9.3 Find all possible triplets in the list that satisfies a^2 + b^2 = c^2 🎢 πŸ’₯
    9.4 There are numbers from 1 to N in an array. One of the number gets duplicated and one is missing. Find out the duplicate number 🎢 [TODO]
    9.5 Given two arrays of integers, find a pair of values (one from each array) you can swap so that both arrays sum to the same value [TODO]
    9.6 Find three numbers when multipled provide max value from the given input
    9.7 Find all possible quadruplets in the list that add up to the given sum
  10. Subarray and condition
    10.1 Find a continuous subarray of sum zero 🎢 πŸš€
    10.2 Find a continuous subarray of sum target given positive values 🎢
    10.3 Find a continuous subarray of sum target given positive and negative values 🎢 πŸš€
    10.4 Print alternate positive and negative values while retaining order πŸ’₯
    10.5 Find pairs in an integer whose sum is equal to a given value
    10.6 Given a list of integers and two target values find the shortest distance between the two target values πŸ’₯ 🎢
    10.7 Find the pivot value that splits the list into balanced partitions 🎢 πŸ’‘
    10.8 Find the maximum subarray sum - Kadane Algorithm 🎢 πŸ’‘
    10.9 Find #occurrences of the largest sum contiguous subarray of modulo K 🎨 πŸ’‘
    10.10 Given a list and a number K, print the maximum sum subarray of size K
  11. Rotated list
    11.1 Rotate a list to the right or left by n places
    11.2 Find minimum in a rotated sorted list #RotationPoint πŸ‘ 🍰
    11.3 Search a target number in a rotated sorted list πŸ’‘
  12. Time intervals
    12.1 Merge overlapping time intervals 🎢
    12.2 Find #conflicting appointments πŸ“
    12.3 Find conflicting appointments
    12.4 Find the next earliest availability given availability and meeting duration πŸš€ 🎢
  13. Design πŸ’‘
    13.1 Design a data structure that implements insert, remove, contains and get random in O(1) time πŸ’‘ πŸš€ πŸ‘
    13.2 Design a data structure that implements increment, decrement, max and min in constant time 🎨 🎢 πŸš€
    13.3 Implement a function that inserts, deletes and getrandom in O(1) time 🎢 πŸ’‘
    13.4 Write a function that returns values randomly, according to their weight πŸ’‘ 🎢

Strings

  1. Find #words in a sentance
  2. Find most and least frequently used words in a sentance
  3. Write a function which finds a closest pair of equal entries πŸ“
  4. Write a function that given an integer returns a formatted number string πŸ“ πŸ’‘ πŸ‘
  5. Given a string for a text message and character limit. Break the message without breaking the words and include message count 🎢
  6. Properties
    6.1 Given two strings find if they are Anagrams
    An Anagram is a rearrangement of the letters of one word or phrase to form another word or phrase
    6.2 Check if two given strings are Isomorphic
    Two strings str1 and str2 are called isomorphic if there is a one to one mapping possible for every character of str1 to every character of str2. And all occurrences of every character in β€˜str1β€² map to same character in β€˜str2β€²
    6.3 Generate all Numeronyms for a given string
    A numeronym is a number-based word. Letters between the first and last are replaced with a number representing the number of letters omitted, such as "i18n" for "internationalization"
  7. Reverse
    7.1 Reverse an integer πŸ‘
    7.2 Reverse a string recursively
    7.3 Reverse all words in a sentance
  8. Palindrome
    8.1 Test if a string is a Palindrome. Ignore all non-alphanumeric characters
    8.2 Given a number find the next largest Palindrome πŸ’‘ 🎢
    8.3 Find the longest palindromic substring - Manacher's algorithm πŸ’‘ 🎢 πŸš€
  9. Substring (A substring is a prefix or suffix of any string. There are n^2 substrings.)
    9.1 Find the number of distinct substrings of a given string πŸ’‘
    9.2 Generate all the substrings of a string
    9.3 Find first occurance of substring
    9.4 Find the longest repeating substring (longest substring of a string that occurs at least twice) πŸ’₯ πŸ’‘ 🎢
    9.5 Find the longest substring with two unique characters 🎢 πŸ‘
    9.6 Find the longest substring with k unique characters
    9.7 Find the longest substring with non-repeating characters
    9.8 Longest Substring with At Most K Distinct Characters 🎨 πŸ‘
    9.9 Find the minimum length of the substring that contains all characters in a given input πŸš€
    10.Given an input string and pattern find the minimum window in the input string that will contain all the characters in the pattern 🎢 πŸš€
  10. Find the first non repeating character in string

Linked Lists

  1. Linked List Library πŸ‘ πŸ’₯
  2. Linked List Introduction
    2.1 Single Linked Lists
    2.2 Double Linked Lists
  3. Find the nth node from the end of a linked list 🎢 πŸ’‘
  4. Circular Linked List, Cycle & Intersection
    4.1 Find the length and start node for the cycle in a linked list πŸ’‘ 🎢
    4.2 Find the node at which the intersection of two single linked lists begins
    4.3 Add a node to a sorted circular linked list πŸ’‘ 🎢
  5. Merge
    5.1 Merge two sorted linked lists [TODO]
    5.2 Merge K sorted linked lists [TODO] πŸ’₯
  6. Given a single linked list with one digit positive integer value
    6.1 Add 1 [TODO]
    6.2 Add given value [TODO]
  7. Reverse a linked list πŸ‘ πŸš€
  8. Check if a linked list is a Palindrome
  9. Find the middle element in a linked list πŸ’‘
  10. Delete a node in the linked list 🎢 πŸ’₯
  11. Zip a linked list 🎢 πŸš€
  12. Split a link list into odd and even values with no additional space πŸš€
  13. Remove duplicate values & retain order of existing values πŸ’₯
  14. Design and implement Least Used Cache (LRU) πŸ’‘ 🎢 πŸš€
  15. Implement skip list
  16. Given linked list return max value at any given time in constant time
  17. Swap adjacent nodes of a linked list [TODO]
  18. Return a linked list that contains the intersection of two linked lists 🎢

Stacks

  1. Implement stack using list
  2. Implement stack using linked list
  3. Implement stack using dynamic array
  4. Implement stack using fixed size array
  5. Implement stack with getMax() that operates in constant time πŸ“
  6. Check if a string containing parenthesis'()' is balanced πŸ“
  7. Check if a string containing just the characters '(', ')', '{', '}', '[' and ']'is balanced
  8. Find the length of the longest valid parenthesis sequence in a string, in O(n) time 🎢 πŸ‘
  9. Given a string where each character can be [0-9] or [+-*] find the result πŸ‘
  10. Find top 3 and bottom 2 values from the list in O(n) πŸ‘
  11. Implement stack using queue [TODO]
  12. Compute largest rectangle area under a histogram πŸš€ 🎢 🎨
  13. Design an algorithm for computing the k-th largest element in a sequence of elements. It should run in O(n) expected time where n is the length of the sequence, which is not known in advnance. The value of K is known in advance. Print the k-th largest element after the sequence has ended. It should use O(k) additional storage [TODO]
  14. Expression evaluator πŸš€
    14.1 Single digit
    14.2 Multiple digits
  15. Find longest file path 🎨

Queue & Double-ended Queue

  1. Implement queue using list
  2. Implement queue using linked list
  3. Implement a queue using two stacks
  4. Queue implementation using dynamic array
  5. Queue implementation using fixed size array
  6. [Design an algorithm to sort a stack in descending order] (https://github.com/harishvc/challenges/blob/master/sort-stack-in-descending-order.py)
  7. Sliding Window Maximum πŸš€ 🎢 πŸ’₯
  8. Implement getMax() that operates in constant time πŸš€
    8.1 Given a queue return max value at any given time in constant time
    8.2 Given linked list return max value at any given time in constant time
  9. Given a screen with all pixels having one of two colors. When a random pixel is clicked, then that pixel & all the adjacent pixels with same color should change the color to the second color [TODO]
  10. Implement blocking queue [TODO]
  11. Implement non-blocking queue [TODO]

Binary Trees

  1. Binary Tree Traversal Library πŸ‘ πŸš€
    1.1 Pre-order
    1.2. In-order
    1.3. Post-order
    1.4 Level-order
  2. Essentials
    2.0 Binary Tree Essentials Library πŸ‘ πŸš€
    2.1 Find # of leaves, half nodes and nodes in a binary tree
    2.2 Find the size of a binary tree
    2.3 Find the height (max depth) of the binary tree 🎢 πŸ‘
    2.4 Find the depth (level) of a node and the path from the root
    2.5 Find the deepest node in binary tree
    2.6 Find diameter (width) of a binary tree πŸ‘ 🎢 πŸ’‘
    2.8 Find all edge nodes (boundary/perimeter) in the binary tree πŸ‘
  3. Path Sum
    3.1 Find the max value of the binary tree
    3.2 Find level than has maximum sum πŸ‘
    3.3 Given path sum check if the path exists πŸ‘
    3.4 Root to leaf path (Iterative)
    3.5 Root to leaf path (Recursive) 🎨 πŸ’‘
    3.6 Find the sum of all root to leaf paths where each path represents a binary number πŸ‘ πŸ“ πŸ’‘
    3.7 Find sum of all leaf nodes
    3.8 Find the sum of all left leaves
  4. Moderate Difficulty
    4.1 Flip/Invert a binary tree πŸ‘
    4.2 Clone a binary tree πŸ‘
    4.3 Check if a binary tree is symmetric (mirror)
    4.4 Check if two binary trees are structurally identical? πŸ‘
    4.5 Complete Binary Tree
    Β Β Β Β Β  4.5.1 Find # nodes in a Complete Binary Tree πŸ’‘ πŸš€
    Β Β Β Β Β  4.5.3 Check if a Binary Tree is Complete Binary tree?
    4.6 Balanced Binary Tree
    Β Β Β Β Β  4.6.1 Check if a binary tree is fully balanced πŸ‘ πŸ’‘
    Β Β Β Β Β  4.6.2 Add a node to a balanced binary tree
    Β Β Β Β Β  4.6.3 Given a full binary tree, add a pointer to the next sibling
    4.7 Given two binary trees T1 and T2, check if T2 is a subset of T1 πŸ’‘ 🎢 πŸ‘
    4.8 Find the ancestors of a node in a binary tree πŸ‘ 🎢 πŸš€
    4.9 Find the Lowest (nearest/first) Common Ancestor (LCA) of two nodes in a binary tree
    Β Β Β Β Β  4.9.1 Traverse down - parent node to child node πŸ‘ 🎢 πŸš€
    Β Β Β Β Β  4.9.2 Traverse up - child node to parent node
    4.10 Find the shortest path between two nodes in a binary tree πŸ‘ 🎢 πŸš€
    Β Β Β Β Β  4.10.1 solution 1: Modify LCA
    Β Β Β Β Β  4.10.2 solution 2: Using root to node path
    4.11 Given a binary tree where path are from parent node to child node, root and leaf can be excluded in the path
    Β Β Β Β Β  4.11.1 Count # path that add up to a given value πŸ’‘ πŸ‘
    Β Β Β Β Β  4.11.2 List all the path that add up to a given value πŸ‘
    4.12 Serialize and Deserialize a Binary tree πŸ’₯ πŸ‘ πŸš€
    Β Β Β Β Β  4.12.1 From pre-order with leaves and half-nodes marked πŸ’‘
    Β Β Β Β Β  4.12.2 From pre-order & in-order
    Β Β Β Β Β  4.12.3 From post-order & in-order
    4.13 Given preorder and inorder traversal construct postorder traversal πŸ’₯ πŸ‘
    4.14 Construct a binary tree from per-order traversal where leaf nodes are marked πŸ’‘ 🎢

Binary Search Tree (BST)

  1. BST Library (add node,delete node, isBST? max, min)
  2. Create BST
    1.1 Convert a unsorted list to BST
    1.2 Convert a sorted list to BST 🎢
  3. Delete node from BST πŸ‘
  4. Find max value of BST
  5. Find min value of BST
  6. Find if an element exists in BST
  7. Check if valid BST πŸ‘
  8. Find inorder successor of node N πŸš€ 🎨 πŸ“ 🎢
  9. In a BST given a target find a value close to the target
  10. Find smallest K in a BST πŸ‘ πŸ’‘
  11. Find largest K in a BST πŸ‘ πŸ’‘ πŸš€
  12. Given a BST find # nodes that lie in the given range
  13. Search in sorted list X for index i such that X[i] = i πŸ’‘ πŸ‘
  14. Given a sorted list create a BST with minimal height πŸ‘ πŸ’‘
  15. Given ordered nodes construct a fully balanced BST πŸ‘
  16. Find all possible combinations that can generate identical Binary Search Tree (BST) πŸ’‘ πŸ‘ πŸ“ 🎨
  17. Given a sorted list and a value, find the first and last occurance of the value πŸ’‘ 🎢
  18. Find the square root of an integer without using square root function πŸ’‘
  19. Find mean of a BST
  20. Find the Lowest (nearest/first) Common Ancestor (LCA) of a BST πŸ’‘ 🎢
  21. Find depth of a binary search tree without using recursion
  22. Implement BST iterator πŸš€ πŸ’‘ 🎢
  23. Find size of BST tree in a Binary Tree 🎢 πŸš€
  24. Delete nodes outside the given range in BST πŸ’‘ 🎢

Heap

  1. Fundamentals
    1.1 Convert unsorted list to max heap in linear time πŸ“ πŸš€
    1.2 Insert value into a heap πŸš€
    1.3 Check if a Binary tree is a Complete Binary Tree [TODO]
    1.4 Heap Sort
  2. Moderate
    2.1. Find Kth maximum in an unsorted list
    2.2. Find the Kth most popular value in an unsorted list
    2.3. Find K popular values in an unsorted list
  3. Advanced
    3.1 Merge K sorted list of size N
    3.2 Maintain a Max Heap of size K

Graph

  1. Fundamentals
    1.1 Directed Acyclic Graph (DAG)
    1.2 Depth First Traversal
    1.3 Breadth First Traversal πŸ‘ πŸ’₯
    1.4 In a directed graph given two nodes find out whether if a path exists
    1.5 Topological Sort (given edges)
    1.6 Topological Sort using Kahn's algorithm (given adjacency list) 🎢 πŸš€
  2. Moderate
    A cycle is a closed path - visit a node for the second time before all its decendents have been visited
    2.1 Detect cycle using Depth First Traversal πŸ‘ 🎢
    2.2 Detect cycle using Topological Sort
    2.3 Given a sorted dictionary (array of words) of an alien language, find order of characters in the language
    2.4 Given a trip start and destination print the itenary
    2.5 Find longest path in a Directed Acyclic Graph from a source vertex πŸ’₯
  3. Advanced
    3.1 Dijkstra shortest path algorithm [TODO]
    3.2 Given a source word, target word and dictionary, transform the source word to target by changing/adding/removing 1 character at a time, while all intermediate words being valid words in the dictionary. Return the transformation chain which has the smallest number of intermediate words #WordLadder πŸ“ πŸ‘
    3.3 Given a boolean 2D matrix, find the number of islands 🎢 πŸš€
    3.4 Given a graph find the Strongly Connected Components (SSC) 🎢 πŸš€

Dynamic Programming

  1. Multiply two numbers without using operators *, / and with minimal operations πŸ‘
  2. Find the power set 🎢 πŸ’‘
    Power Set is a set that includes all the subsets including an empty set and the set itself.
    2^N subsets for a set of size N
  3. Generate all possible N pairs of balanced parentheses πŸš€ πŸ’‘
  4. Find string combinations of length K
  5. Find all permutations of a string in sorted (lexicographic) order - should handle duplicate values 🎢 πŸš€ πŸ’‘
  6. Given stock prices during a time period find maximum gain
    6.1 singe purchase and sale πŸ“
    6.2 Multiple single purchases and sales without overlaps 🎨 πŸ‘
  7. Partition
    7.1 Can the given list be partitioned into two sub-lists with equal sum (balanced partition)?🎢
    7.2 Given a list, identify two sub-lists with equal sum (balanced partition, using DP) πŸš€ πŸ’‘
    7.3 Given a list, identify all sub-lists with equal sum (balanced partition, using back tracking) 🎢
  8. Longest Increasing Subsequence (LIS)
    8.1 Given a list of random numbers. Find length of Longest Increasing Subsequence (LIS) and the sequence 🎢
    8.2 Given a list of random numbers. Find all the increasing subsequences
  9. Given n stairs to reach the top and you can take 1 or 2 steps at each stair
    9.1 Find #ways a person can reach the top of the stairs 🎢
    9.2 Find all possible combinations πŸ’‘
  10. Given target and possible values
    10.1 Find #combinations to achieve the target 🎢 πŸš€
    10.2 Find all unique combinations to achieve the target 🎨
  11. Given denominations and a total
    11.1 Minimum # coins needs to reach the total and what are the coins? πŸš€ 🎢
    11.2 Find all possible combinations to reach a total πŸ’‘ πŸ’₯
    11.3 Find all possible combinations to reach a total using lookup πŸ’‘ πŸ’₯
  12. Determine the maximum possible value from the coin play game πŸš€ 🎢 πŸ’‘
  13. What is the minimum attempts to find out from which floor egg will break?
    13.1 2 Eggs 🎨 πŸš€ πŸ’‘
    13.2 N eggs 🎢 πŸš€
  14. How many different 10-digit numbers can be formed starting from 1? movement from 1 digit to the next is similar to the movement of the Knight in a chess game πŸ’‘ πŸš€
  15. Find the nth Fibonacci number
    15.1 Iterative, Recursive, Bottom-up & Top-down
    15.2 Recursive with lookup
  16. Longest Common Subsequence (LCS) πŸ’₯ πŸ‘
    subsequence is a generalization of substring. For example, "Itwastimes" is a subsequence of "It was the best of times", but not a substring
    16.1 Length of the LCS
    16.2 Find the LCS
    16.3 Find all the sequences πŸš€
    16.4 Implement Unix diff command
  17. Longest Common Substring
    17.1 Length of the Longest Common Substring
    17.2 Find the Longest Common Substring
    17.3 Longest common substring of more than two strings
  18. Find #steps to convert string1 to string 2 using operations insert,remove,replace πŸ‘ πŸš€
  19. Input string and dictionary of words
    19.1 Can the input word be split using space-separated sequence of dictionary words? 🎢 🎨
    19.2 Construct all possible sentences where each word is a valid dictionary word πŸ’‘ πŸš€
  20. Given two sequences find the longest palindrome
  21. Text justification
    21.1 Given a string and limit provide line breaks based on even distribution of empty spaces πŸ’‘ 🎢
    21.2 Pack your words in a greedy approach, evenly distribute space TODO
  22. Binary matrix
    22.1 Find #path from top left to bottom right πŸ’‘
    22.2 Find out the maximum square size sub-matrix πŸš€ 🎢
    22.3 Find area of the largest rectangle πŸš€ πŸ’‘ 🎢
    22.4 Find #rectangles
  23. Matrix multiplication
    23.1 Find the most efficient way to multiply these matrices 🎢 πŸ’‘
    23.2 Find the order in which the matrices need to be multiplied
  24. Given the weight and a value of cakes and a duffel bag with max capacity, find the max value that can be filled in the duffel bag πŸ’‘ 🎨

Design & Algorithms

  1. Given a million points (x, y), give an O(n) solution to find the n points closest to (0, 0)
  2. Implement T9
  3. How to find list of possible words from a letter matrix (Boggle)
  4. Given a family tree, find oldest sisters of the given person, oldest sister in the family tree and the oldest ancestor
  5. Design a command line alarm clock
  6. Design a rate limiting web service πŸ’₯ πŸ’‘ 🎢
  7. Using OOP design a elevator 🎢
  8. Design a data structure that implements insert, remove, contains and get random in O(1) time πŸ’‘ πŸš€ πŸ‘
  9. Design a data structure that implements increment, decrement, max and min in constant time 🎨 🎢 πŸš€
  10. Implement a function that inserts, deletes and getrandom in O(1) time 🎢 πŸ’‘
  11. Write a function that returns values randomly, according to their weight πŸ’‘ 🎢

Algorithms and Data Structures Resources

Python Resources

Interview Resources

Amazing Technical Discussions

GitHub Resources

About

A personal log of learning and solving problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages