Code Monkey home page Code Monkey logo

coding_interview_questions's Introduction

Coding Interview Questions

List of some of the famous coding interview questions and their solutions.

Table of Content

  1. Arrays

    1. Find Next Greater Element
    2. Find Pythagoras Triplets
    3. Find 3 items whose sum matches K
    4. Stock Span Problem
    5. Longest Increasing Subsequence
    6. Max Difference between two elements
  2. 2D Arrays / Matrix

    1. Rotate Matrix by 90 degree
  3. Numbers

    1. Fibonacci Series
    2. Find all prime numbers in a Range
    3. Find Missing numbers in Increasing sequence
  4. Linked Lists

    1. Add 2 Numbers represented by Linked List
    2. Find the merging point of 2 linked lists
    3. Reverse a LinkedList in group
  5. Set

    1. Create sets for given array
  6. Strings

    1. First recurring character within a string
    2. Given a string, find all sub-strings which are Palindromes
    3. Replace char with word
    4. Find if 2 strings are Anagram
  7. Write your own questions

    1. WYO - HashMap
    2. LRU Cache
    3. Fast DS
  8. Tree

    1. Height of Binary Tree
    2. Tree Column Wise Sum
    3. Zig Zag Level order Traversal
    4. Check if 2 Binary trees are identical
    5. Binary Tree - Right View
    6. Binary Tree - Top View
    7. Binary Tree - Traversal
    8. Binary Tree - Level Order Traversal
    9. Binary Tree - Reverse Level Order Traversal
    10. Binary Tree to Sum Tree

NextGreaterElement - The Next greater Element for an element x is the first greater element on the right side of x in array. Elements for which no greater element exist, consider next greater element as -1.

PythagorasTriplets - Given an array, find if it contains the Pythagoras Triplets. Triplet (a,b,c) such that a^2 + b^2 = c^2.

Three Sum Problem - Given an array and a value, find if there is a triplet in array whose sum is equal to the given value.

StockSpan - https://www.geeksforgeeks.org/the-stock-span-problem/

LongestIncreasingSubsequence - https://www.interviewbit.com/problems/longest-increasing-subsequence/. Find the number of elements in the longest increasing subsequence.

Maximum Difference between two elements - https://www.geeksforgeeks.org/maximum-difference-between-two-elements/ - Maximum difference between two elements such that larger element appears after the smaller number.

RotateMatrixBy90Degree - Given a n * n matrix, rotate its element by 90 degrees.

Numbers

FibonacciSeries (Dynamic Programming) - Find Fibonacci series upto N.

FindAllPrimeNumbersInRange - Find all prime numbers in a given range (N, M)

FindMissingNumbersInIncreasingArray - Given an array which has numbers from [1...N] find the missing number.

Add2NumbersRepresentedByLL - Given two numbers represented by two lists, write a function that returns sum list. The sum list is list representation of addition of two input numbers.

MergingPointOf2Liists - Given the pointers to the head node of 2 lists which will surely merge, find the merging point (node), at which they merge.

ReverseLinkedListInGroup - Reverse Linked List within a group of k elements. For example, if the list is 1 -> 2 -> 3 -> 4 -> 5 ->6 -> 7 and k = 3, then output list will be 3 -> 2 -> 1 -> 6 -> 5 -> 4 -> 7.

SetForGivenArray - Create set consisting of all the possible combinations of elements, for a given array.

FirstRecurringCharacter - Find the first recurring character within a given string.

AllSubstringPalindromes - Given a string, find all the substrings of that string which are palindrome

ReplaceACharWithAWord - Replace a single char of a String, with a word (String replace without using Java built-in functions)

TwoStringAnagram - Find of 2 strings are Anagrams

"Write your own" interview questions, tests your ability of understanding a particular concept or data structure.

HashMap - HashMap is a hash based Key-Value pair data structure, which will give O(1) time complexity for put and get operations. "Write-your-own" HashMap is a famous Java data structure based interview question to understand, how deep you know about this famous data structure.

LRUCache - LRU Cache - is a key-value pair, which is of fixed length. Whenever the capacity of the cache reaches to MAX, then it evicts the "Least Recently Used" key.

FastDS - A custom data structure, which performs add, delete, get and getRandom() operation @ O(n) complexity

HeightOfBinaryTree - is a recursive way of finding the height of a binary tree (height of binary tree - max (height of left sub-tree, height of right sub-tree)

Column Wise Sum of Binary Tree - Column wise sum of binary tree

Zig Zag Traversal on Binary Tree - Zig Zag traversal on binary tree (level order) using 2 stacks

Check if 2 binary trees are identical - Using recursion to find out if 2 binary trees are identical

RightView - Right view of the Binary Tree

TopView - Top view of the Binary Tree

Traversal - All 3 traversals of Binary Tree (Inorder, Preorder and Postorder)

LevelOrderTraversal - Level order Traversal of the Binary Tree

ReverseLevelOrderTraversal - Reverse Level order Traversal of the Binary Tree

BinartTreeToSumTree - Binary tree to the sum tree problem. Each parent node will have a value = cumulative (left node value + right node value)

coding_interview_questions's People

Contributors

sanbhat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.