Skip to content

rootusercop/interviewproblems

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A COMPILATION OF COMMON INTERVIEW QUESTIONS AND SOLUTIONS.

PLEASE FILE AN ISSUE IN CASE OF A BUG OR ADD A COMMENT.

Sections:---

Arrays

  1. Given +ve numbers in an array.Put the even #s to the left of the array and the odd to the right side of the array . Don't use extra array.
  2. Given a sequence of non-negative integers find a subsequence of length 3 having maximum product with the numbers of the subsequence being in ascending order.
  3. Shift array of integers circularly given input array and shift size.
  4. Check if a sub-array exists in parent array.
  5. Find duplicates count in sorted array.
  6. Write a program takes array input{1,0,2,3} and num = 3 and provides output {1,2}{0,3}{2,1}{3,0} sum equals the num.
  7. Find the contiguous subarray which has the largest sum. Kadane's algorithm.
  8. Print numbers with frequency.
  9. Find Number with Highest frequency in sorted array.

Collections

  1. Find cartesian of lists.
  2. Implement custom linked list.
  3. Check if a linked list has loops.
  4. Find nth element from end of the linked list.
  5. Flatten a nested list.
  6. Given a nested list of integers, returns the sum of all integers in the list weighted by their depth.

Iterator

  1. Implement custom iterator.

Graphs

  1. Breadth First Search
  2. File Dependency Resolution

Heaps

  1. Max Heaps
  2. Min Heaps

Maps

  1. Custom HashMap implementation.
  2. Least Recently Used (LRU) cache implementation.

Number-Problems

  1. Concatenate two numbers. for e.g. 123, 0456 = 1230456
  2. Convert string to number.
  3. Find factorial of a number.
  4. Find missing number in stream of numbers.
  5. Swap Numbers.

Objects

  1. Cloning example (Linked List).
  2. Implement an Immutable class.
  3. Pass by value example.
  4. Implement a singleton class.

Sorting

  1. Bubble Sort.
  2. Insertion Sort.
  3. Merge Sort.
  4. Quick Sort.
  5. Selection Sort.
  6. Shell Sort.

Stack/Queues

  1. Implement a queue using stack.

Strings

  1. Check string palindrome.
  2. Find common prefix for a given list of strings.
  3. Find duplicate strings in list of strings.
  4. Find latest version problem.
  5. Find Longest Common Subsequence.
  6. Find Longest Palindrome in a string.
  7. Print permutations of all characters in a string.
  8. Find total number of palindromes in a String.
  9. Find first non-repeated character.
  10. Given two (dictionary) words as Strings, determine if they are isomorphic.
  11. Given s string, Find max size of a sub-string, in which no duplicate chars present.
  12. Find min substring that contains all the char of target string.
  13. Print diamonds on basis of input size.
  14. Reverse a string.
  15. Find all dictionary words in a given string.
  16. Return true if stringA is subsequence of stringB.

Threads

  1. Implement blocking queue.
  2. Simulate a deadlock.

Trees

  1. Check Balanced Tree.
  2. Check if a tree is Subtree of parent tree.
  3. Find diameter Of Tree.
  4. Find All Paths Equal To Sum.
  5. Find Sum Of All Nodes Except Leaf.
  6. Left View of a Tree.
  7. Mirror Given Tree.
  8. Check if a tree is Mirror of another Tree.
  9. Print Nary Tree With Levels.

*** NOTE: Some problems might be in-complete. I have added TODO for such problems. ***

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published