├── .gitignore ├── Adobe └── README.md ├── AirAsia └── README.md ├── Amazon └── README.md ├── AmericanExpress └── README.md ├── Atlassian └── README.md ├── BookMyShow └── README.md ├── Box └── README.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── DE Shaw └── README.md ├── Expedia └── README.md ├── Facebook └── README.md ├── Flipkart └── README.md ├── Google └── README.md ├── Grab └── README.md ├── Groupon └── README.md ├── Intel └── README.md ├── Intuit └── README.md ├── JP Morgan Chase └── README.md ├── LICENSE ├── LinkedIn └── README.md ├── MakeMyTrip └── README.md ├── Media.net └── README.md ├── Microsoft └── README.md ├── Mindtickle └── README.md ├── MobiKwik └── README.md ├── NEC Technologies └── README.md ├── Netflix └── README.md ├── Ola Cabs └── README.md ├── Palantir └── README.md ├── PayPal └── README.md ├── Postmates └── README.md ├── README.md ├── RedHat └── README.md ├── Roblox └── README.md ├── SAP Labs └── README.md ├── Samsung ├── README.md ├── res │ ├── .nofile │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ └── jewel.jpg └── solution │ └── cr1.markdown ├── Snowflake └── README.md ├── Thoughtworks └── Readme.md ├── Twitter └── README.md ├── Uber └── README.md ├── Verizon └── README.md ├── Walmart Labs └── README.md ├── Yatra.com └── README.md ├── Yelp └── README.md ├── Zomato └── README.md ├── _config.yml ├── check.java ├── splash.png └── thumbnail.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea/ -------------------------------------------------------------------------------- /Adobe/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Adobe Interview Questions 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [References](#ref) 7 | ____ 8 | Coding round questions
9 | - Count set bits in an integer 10 | - Program for Binary To Decimal Conversion 11 | - Check if a given array can represent Preorder Traversal of Binary Search Tree 12 | - Sort an array of 0s, 1s and 2s 13 | - Check if a number is a Palindrome 14 | - Pascal's Triangle 15 | - Trapping Rain Water 16 | - Count Inversions in an array | Set 1 (Using Merge Sort) 17 | - Write an Efficient Function to Convert a Binary Tree into its Mirror Tree 18 | - Find the middle of a given linked list in C and Java 19 | - Merge Sort for Linked Lists 20 | - Print Right View of a Binary Tree 21 | - Reverse Level Order Traversal 22 | - Level order traversal in spiral form 23 | - Remove duplicates from a sorted linked list 24 | - K’th Smallest/Largest Element in Unsorted Array 25 | - Smallest/highest element in the left/right side (Multiple time asked) 26 | - Stock span problem 27 | - Top View of a bst 28 | - Sort an array by their frequency 29 | - Validate if a given string is numeric. 30 | Examples:
31 | "0" => true
32 | " 0.1 " => true
33 | "abc" => false
34 | "1 a" => false
35 | "2e10" => true
36 | Return 0 / 1 ( 0 for false, 1 for true ) for this problem 37 | 38 | ---- 39 | Technical Interview Questions 40 |
41 | Data Structures and Algorithms 42 |
43 |
44 | 45 | - Implement LRU cache 46 | - Find the numeric value of the integer passed as a string 47 | - Search an element in an array rotated unknown number of times. 48 | -------------------------------------------------------------------------------- /AirAsia/README.md: -------------------------------------------------------------------------------- 1 | ## AirAsia Interview Questions 2 | 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | ____ 9 | Coding round questions
10 | 11 | - Given an array A, divide it into two arrays say B and C, such that the sum of elements in array B is greater than or equal to the sum of elements in array C and array B should have a minimum number of elements. 12 | - Given an array, return the number of recurring elements. 13 | - Given an array, find the Longest Increasing Subsequence (LIS). 14 | - Find the median of two sorted arrays. 15 | 16 | ---- 17 | Technical Interview Questions 18 | 19 |
20 | Data Structures and Algorithms 21 | 22 | - Given an array A, arrange it in a zig-zag manner. By zig-zag manner, what is meant is that "A[0] < A[1] > A[2] < A[3] > A[4] ...." 23 | - Explain merge sort. 24 | - Explain the difference between Binary trees and AVL trees. 25 | - What data structure is used in the internal implementation of hashmaps? 26 | - You are given the stock prices of a company for the month, you can buy stocks and sell stocks on any particular day, provided the stocks are bought before they are sold. You need to do "n" such buy-sell transactions and maximize the profit. 27 | - Given an infinite sorted binary array of 0's and 1's, find the index where the first 1 is present. 28 | - Find all the permutations of a given string. 29 | - Given an array, return the index of the first non-recurring element. 30 | 31 |
32 | DBMS 33 | 34 | - Given a job table with job_id, job_start_date and job_end_date, find all the jobs that were active in the given interval of time, say from 10th August 2019 to 10th September 2019. 35 | 36 |
37 | Operating System 38 | 39 | - Explain the difference between processes and threads. 40 | - Explain different CPU scheduling algorithms. 41 | -------------------------------------------------------------------------------- /Amazon/README.md: -------------------------------------------------------------------------------- 1 | # Amazon Interview Questions 2 | 3 | - [Coding Round Questions](#coding) 4 | - [Technical Interview Questions](#tech) 5 | - [Data Structures and Algorithms](#dsalg) 6 | - [DBMS](#dbms) 7 | - [Operating System](#os) 8 | - [System Design](#design) 9 | 10 | --- 11 | 12 | Coding round questions
13 | 14 | - Given an array of distinct elements and a number x, find if there is a pair with product equal to x. 15 | - Given a string ‘str’ of digits and an integer ‘n’, build the lowest possible number by removing ‘n’ digits from the string and not changing the order of input digits. 16 | - Given a number, find its corresponding Roman numeral. 17 | - Given a linked list, write a function to reverse every k nodes (where k is an input to the function). 18 | - Given phone digits, print all possible words that can be formed from them. 19 | - You are given an array of integers. Return an array of the same size where the element at each index is the product of all the elements in the original array except for the element at that index. 20 | For example, an input of [1, 2, 3, 4, 5] should return [120, 60, 40, 30, 24]. 21 | You cannot use division in this problem. 22 | - Given a linked list and two integers M and N. 23 | Traverse the linked list such that you retain M nodes then delete next N nodes, continue the same till the end of the linked list. 24 | For example, an input of M = 2, N = 2 Linked List: 1->2->3->4->5->6->7->8 should return Linked List: 1->2->5->6 25 | 26 | - Given an array consisting many inner arrays, flatten the array into one: 27 | example: input: [[6,4,7,[9,5,4,[2,4,8]]],[2,2,7],[9,0,7,[9,3,1,8,5]]] 28 | output: [6,4,7,9,5,4,2,4,8,2,2,7,9,0,7,9,3,1,8,5] 29 | 30 | - Given two sorted linked lists, merge them so that the resulting linked list is also sorted. 31 | - Given a set of points find the one with the shortest distance from the origin 32 | - Reverse the bits of an 32 bit unsigned integer A. 33 | - Find if Given number is power of 2 or not. 34 | More specifically, find if given number can be expressed as 2^k where k >= 1. 35 | - Imagine that an employee tree represents the formal employee heirarchy at Amazon. Manager nodes have child nodes for each employee that reports to them; each of these employees can, in turn, have child nodes representing the number of months the employee has spent at the company. Team tenure is computed as the average tuenure of the manager and all the company employees working below the manager. The oldest team has the highest team tenure. Write an algorithm to find the manager of the team with the highest tenure. An employee must have child nodes to be a manager. 36 |
37 | 38 | - Maximize partitions such that no two substrings have any common character 39 | - Find Square Root of a whole number without using standard functions 40 | - Priority Inversion 41 | - Detect cycle in a directed graph 42 | - Recursively Reversing a linked list 43 | - Given a binary tree, print it's top view. 44 | - Find whether one binary tree is present in another binary tree. 45 | - Merge k sorted arrays. 46 | - Given a matrix where each row and each column is sorted, check whether the given number is present in the matrix. 47 | - Given a string of parenthesis like {()[{]).Check if it balanced or not. 48 | - Assembly Line Scheduling(Dynamic programming) 49 | - The Celebrity Problem 50 | - Given a string S consisting only of opening and closing parenthesis 'ie '(' and ')', find out the length of the longest valid(well-formed) parentheses substring. 51 | NOTE: Length of the smallest valid substring ( ) is 2. 52 | 53 |
54 | 55 | Technical Interview Questions 56 |
57 | Data Structures and Algorithms 58 | 59 | - There is an infinite stream of Products. Write a program to print top 10 cheapest products at any given point of time. Do it within fixed amount of memory i.e. you can't consume unknown amount of memory. (Hint: Heaps) 60 | - Given n fences, WAP to paint them with k colours such that not more than 2 consecutive fences are of same colour. 61 | - Suppose there are 2 glasses with capacities 5 litres and 3 litres. The glasses can only be completely filled or completely emptied. The water can be transferred from one glass to another, for eg. 5 ltrs glass can transfer all water to 3 ltrs glass and 2 ltrs of water will be left in 5 ltrs of glass. You cannot partially empty or fill any glass. The goal is to get 4 ltrs of water in any one glass. WAP to do this with n number of glasses with given capacities for each and the final capacity to achieve being k in any 1 glass. Print the least number of steps required to do so. 62 | - Given a large 2D array with numbers increasing as you go right or you go down. Convert this into a sorted 1D array in fixed amount of memory. (Hint: Heaps) 63 | - Given a large 1D array of 0's and 1's.Find the largest subarray which contains equal numbers of 0's and 1's. (Hint: Similar to largest subarray with zero sum) 64 | 65 |
66 | DBMS 67 | 68 | - Difference between different type of Normalisation. 69 | - Difference between SQL and NoSQL 70 | - Define the ACID properties. 71 | - What is Cursor? How to use a Cursor? 72 | 73 |
74 | Operating System 75 | 76 |
77 | System Design 78 | 79 | - Design a system that controls traffic lights with below assumptions: 80 | 81 | 1. A group of traffic lights has two components: main lights and pedestrian lights. 82 | 1. Main traffic lights have three colors: red, yellow and green. 83 | 1. Pedestrian lights have two colors: red and green. 84 | 1. Pedestrian lights' colors are reversed from main lights: 85 | 86 | - Main: red/yellow - pedestrian's: green 87 | - Main: green - pedestrian: red 88 | 89 | 1. There is a button for pedestrian lights if the button is pushed in advance, pedestrian's lights change colors according to the main ones if the button isn't pushed, pedestrian's lights remain red. 90 | 1. A typical junction has 4 groups of lights. 91 | 1. Additional question: design the system in a way that allows cars which start from one junction after a red light don't have to stop at the next one. 92 | 93 | - Design a card game by considering the following assumptions: 94 | 95 | 1. There should be more than one method of cards distribution such as even distribution, uneven distribution, etc. 96 | 1. There are multiple situations which could be considered as a winning situation: 97 | 98 | - One who finishes all his cards early. 99 | - One who earns the maximum points at the last. 100 | 101 | - Design a task management system like Trello with the following assumptions: 1. User can move tasks from one lane to the other and move it back. 2. This should have a state diagram with many end states. 102 |
103 |
104 | Miscellaneous 105 | 106 | - Design a task management system like Trello with the following assumptions: 107 | 1. User can move tasks from one lane to the other and move it back. 108 | 2. This should have a state diagram with many end states. 109 | - Design a Circular Buffer having the abilty of variable partitioning. 110 | - Describe the main features of object oriented programming. 111 | -------------------------------------------------------------------------------- /AmericanExpress/README.md: -------------------------------------------------------------------------------- 1 | 2 | # American Express Interview Questions 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [System Design](#design) 9 | * [Miscellaneous](#misc) 10 | * [References](#ref) 11 | ____ 12 | Coding round questions
13 | - Candy Love Problem 14 | - Graph Problem 15 | - XOR Sum Problem 16 | - Sherlock and Cost Problem 17 | - Merge Sort Algorithm Problems 18 | - Given a list of Students and Subjects along with credits of each, a student can select only those subjects whose credits are less than equal to his/her credits. 19 | Return the number of pairs of students and subjects. 20 | - Find LCA of a binary tree. 21 | 22 | Technical Interview Questions 23 |
24 | Data Structures and Algorithms 25 | - What is dangling pointer. 26 | - Post increment operator. 27 | - Static functions. 28 | - Sieve Algorithm. 29 | 30 |

31 | DBMS 32 | - SQL queries related to self-join and find Manager and employee in a given table. 33 | 34 |
35 |
36 | Operating System 37 | 38 |
39 |
40 | System Design 41 | 42 |
43 |
44 | Miscellaneous 45 | - 3 bulbs and 3 switches puzzle 46 | - A bee traveling between two trains puzzle 47 | -------------------------------------------------------------------------------- /Atlassian/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Atlassian Interview Questions 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [System Design](#design) 9 | * [Miscellaneous](#misc) 10 | * [References](#ref) 11 | ____ 12 | Coding round questions
13 | - Two strings are anagrams if they are permutations of each other. For example, “aaagmnrs” is an anagram of “anagrams”. Given an array of strings, remove each string that is an anagram of an earlier string, then return the remaining array in sorted order. 14 | 15 | - Given an array of n points in the plane, and the problem is to find out the closest pair of points in the array. 16 | ---- 17 | Technical Interview Questions 18 |
19 | Data Structures and Algorithms 20 | 21 |

22 | DBMS 23 | 24 |
25 |
26 | Operating System 27 | 28 |
29 |
30 | System Design 31 | 32 |
33 |
34 | Miscellaneous 35 | -------------------------------------------------------------------------------- /BookMyShow/README.md: -------------------------------------------------------------------------------- 1 | ## BookMyShow Interview Questions 2 | 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [Computer Networks](#cn) 9 | * [Miscellaneous](#misc) 10 | * [References](#ref) 11 | ____ 12 | Coding round questions
13 | 14 | - Given two strings, return minimum no of modifications to convert one string into an anagram of others. 15 | - Given preorder traversal of a tree, check if it is the pre-order traversal of a BST 16 | - Given a number n, we want to reduce this number to zero. Return minimum no of operations to be performed. 17 | A particular bit of a number can be changed to zero by only one of the two operations available at a time, 18 | - if (i+1)th bit is 1 and all the bits from (i+2)th bit to the least significant bit is zero. 19 | - the least significant bit can be toggled 20 | - Given an expression string exp, write a program to examine whether the pairs and the orders of “{“,”}”,”(“,”)”,”[“,”]” are correct in exp. 21 | 22 | ---- 23 | Technical Interview Questions 24 |
25 | Data Structures and Algorithms 26 | 27 | - Given an array, return the number of distinct unordered pairs from this array 28 | 29 |
30 | Operating System 31 | 32 | - What is cache invalidation? Implement LRU cache. 33 | - What are semaphores? 34 |
35 | 36 | Computer Networks 37 | 38 | - What happens when you hit www.google.com on chrome. Explained the entire flow. 39 |
40 | 41 | Miscellaneous 42 | 43 | - Questions on asynchronous Javascript. 44 | - Promises 45 | - Async/await 46 | - Is Nodejs singe-threaded? 47 | - Javascript event loop 48 | - Phone number validation along with all use cases 49 | 50 | -------------------------------------------------------------------------------- /Box/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at rishabhmaurya.maurya@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contribution Guidelines 2 | 3 | Please make sure that your pull request adheres to the following guidelines: 4 | - For each company, make a separate pull request. 5 | - Pull requests pertaining to grammatical mistakes, removing whitespaces or renaming are highly discouraged. 6 | - The pull request and commit message should include what was added/removed. 7 | - Ensure that you don't replicate the same content. 8 | - Do not forget to mention the references in the footer section. 9 | - Given below is a general template for adding questions of a company not listed in the project. 10 | - Each article will consist of three sections:- Coding round questions, Technical Interview Questions and References. 11 | - Coding round comprises questions asked in online/paper coding round. Typically, this is the first round of interview. 12 | - Technical Interview Questions includes DS Algo, DBMS, OS and Miscellaneous sections. 13 | - Miscellaneous may include questions from design patterns, software development, system design and Object Oriented Programming. 14 | - Don't add one or two questions, just for the sake of PRs for hacktoberfest. Make quality contribution. 15 | - If there is a telephonic round, add it before coding round questions as given below. 16 | 17 | **Note:** People with major contribution will be featured in top contributors section. 18 | 19 | Happy Coding! :v: 20 | 21 | ## Sample template 22 | 23 | ## COMPANY_NAME Interview Questions 24 | * [Telephonic Round Questions](#telephonic) 25 | * [Coding Round Questions](#coding) 26 | * [Technical Interview Questions](#tech) 27 | * [Data Structures and Algorithms](#dsalg) 28 | * [DBMS](#dbms) 29 | * [Operating System](#os) 30 | * [Miscellaneous](#misc) 31 | * [References](#ref) 32 | ____ 33 | Coding round questions
34 | 35 | - Questions in this section. 36 | 37 | ---- 38 | Technical Interview Questions 39 |
40 | Data Structures and Algorithms 41 | 42 | - Questions in this section. 43 |
44 | DBMS 45 | 46 | - Questions in this section. 47 |
48 | Operating System 49 | 50 | - Questions in this section. 51 |
52 | Miscellaneous 53 | 54 | - Questions in this section. 55 | -------------------------------------------------------------------------------- /DE Shaw/README.md: -------------------------------------------------------------------------------- 1 | ## DE Shaw Interview Questions 2 | * [Telephonic Round Questions](#telephonic) 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [Miscellaneous](#misc) 9 | * [References](#ref) 10 | ____ 11 | Coding round questions
12 | 13 | - Replace all the spaces in a string with ‘%20’. 14 | - Find Excel column name from a given column number. Eg. 1 = A, 26 = Z, 27 = AA, 52 = AZ etc. 15 | - Find inorder successor of a node in a binary search tree with parent pointer. 16 | 17 | ---- 18 | Technical Interview Questions 19 |
20 | Data Structures and Algorithms 21 | 22 |
23 | DBMS 24 | 25 | - Describe deadlock and conditions necessary for it to occur. 26 | - What is mutual exclusion and why is it required? How to acheive mutual exclusion? 27 |
28 | Operating System 29 | 30 |
31 | Miscellaneous 32 | 33 | -------------------------------------------------------------------------------- /Expedia/README.md: -------------------------------------------------------------------------------- 1 | # Expedia Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [DBMS](#dbms) 6 | * [Operating System](#os) 7 | * [Miscellaneous](#misc) 8 | * [References](#ref) 9 | ____ 10 | Coding round questions
11 | - Given a collection of intervals, merge all overlapping intervals. 12 | ``` 13 | For example, 14 | Given [1,3],[2,6],[8,10],[15,18], 15 | return [1,6],[8,10],[15,18] 16 | ``` 17 | - Given an input string, reverse the string word by word. 18 | ``` 19 | For example, 20 | Givens = "the sky is blue", 21 | return "blue is sky the". 22 | ``` 23 | - Find the maximum sum of the subarray. 24 | 25 | - We define a `k-subsequence` of an array as follows: 26 | 27 | 1) it is a subsequence of consecutive elements in the array. 28 | 29 | 2) the sum of the subsequence's elements s is evenly divisible by k`(i.e. s % k == 0)`. 30 | Given an integer and input array, find out the number of k-subsequences. 31 | Example: k=3 and array be `[1 2 3 4 1] ` 32 | Output: 4 `({1 2},{1,2,3},{2,3,4},{3})`. 33 | 34 | - You are given an array with duplicates. You have to sort the array with decreasing frequency of elements. If two elements have the same frequency, sort them by their actual value in increasing order. 35 | e.g: ``[2 3 5 3 7 9 5 3 7]`` 36 | Output: ``[3 3 3 5 5 7 7 2 9]`` 37 | 38 | - You are given two string (like two statements). You have to remove all the words of second-string from first string and print the remaining first string. Please maintain the order of the remaining words from the first string. You will be only removing the first word, not all occurrence of a word. 39 | Example: Str1 = "A Statement is a Statement" 40 | Str2 = "Statement a" 41 | Output: "A is Statement" 42 | - You are given an integer. Print its 4th least significant bit. 43 | 44 | - Harry is trying to climb a pole. He climbs the pole in terms of hops. The height of the pole is k. Harry at a time can make a hop of: 45 | 1.) 1 unit 46 | 2.) n units 47 | Find the minimum number of hops Harry would need to reach the top of the pole. 48 | 49 | - Given two positive floating-point numbers `(x,y)`, calculate `x/y` to within a specified epsilon without using in-built functions. 50 | 51 | - Write a recursive function to generate Pascal triangle. 52 | 53 | - Write a program to move all the zeros to the beginning. Input `{1,2,3,0,0,0,4,5}` Output `{0,0,0,1,2,3,4,5}`. 54 | 55 | - Given a +ve integer, find the next highest number in the numerical order using the same numbers present in the given integer. 56 | Example : 218765 57 | Output : 251678 58 | 59 | - Implement atoi to convert a string to an integer. 60 | 61 | - There is an infinite integer grid at which N people have their houses on. They decide to unite at 62 | a common meeting place, which is someone's house. 63 | From any given cell, all 8 adjacent cells are reachable in 1 unit of time. 64 | eg: (x,y) can be reached from (x-1,y+1) in a single unit of time. 65 | Find a common meeting place which minimises the sum of the travel times of all the persons. 66 | 67 | Input Format: 68 | N 69 | The following N lines will contain two integers saying the x & y coordinate of the i-th person. 70 | 71 | Output Format: 72 | M M = min sum of all travel times; 73 | - Ashley has a bunch of coins she wants to arrange into staircases. She starts with a row of 1 coin which goes on top of a row of 2 coins, then 3 coins and so on. Each row should have exactly 1 more coin than the row above it. Determine the number of complete rows of coins in her finished staircase. 74 | 75 | For example, if she's got 6 coins, she can create a staircase with 1 coin in the top row, 2 in the second and 3 in the third. She can complete 3 rows. It would take at least 4 more coins, 10 coins total, for her to be able to create a 4th complete row. 76 | 77 | - Given an array of n integers. The problem is to find the maximum length of the subsequence with the difference between adjacent elements as either 0 or 1. 78 | 79 | Input : arr[] = {2, 5, 6, 3, 7, 6, 5, 8} 80 | 81 | Output: 5 82 | 83 | The subsequence is {5, 6, 7, 6, 5}. 84 | 85 | ---- 86 | Technical Interview Questions 87 | 88 | - A server can call an API once per second. How would you ensure that it calls 1/sec given that it's a multithreaded environment? If there are multiple servers how would you ensure that the calls remain 1/sec? 89 | 90 | Miscellaneous 91 | - What is the __init__.py file in Python? 92 | - What does the double underscore represent in Python? 93 | - Puzzle: You are given 8 identical looking balls. One of them is heavier than the rest of the 7 (all the others weigh the same). You a provided with a simple mechanical balance and you are restricted to only 2 uses. Find the heavier ball. 94 | -------------------------------------------------------------------------------- /Facebook/README.md: -------------------------------------------------------------------------------- 1 | # Facebook Interview Questions 2 | * [Telephonic Round Questions](#telephonic) 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [Miscellaneous](#misc) 9 | * [References](#ref) 10 | ____ 11 | Telephonic round questions
12 | 13 | - You are given the start time and finish time of n intervals. You have to write a a function that returns boolean value indicating if there was any overlapping interval in the set of existing intervals. (Sort and check, time complexity O(nlogn)). 14 | - You have 2 sparse vectors (large number of 0’s). First tell me a way to represent and store them, and then find the dot product. 15 | (To store them, we should store the value and index of those indexes that have a non-zero value, and then finding the dot product is very straight forward). 16 | - You have an array of n elements, and a sum. Check if any 2 elements in the array sum to the given sum. 17 | - Given an array A[] of N numbers and another number x, determine whether or not there exist three elements in A[] whose sum is exactly x. 18 | - Given an array of strings, return the common prefixes, if not found return an empty array. 19 | Ex. ['abcd', 'abb', 'acd'] -> return 'a' 20 | - Given an array of ints, return the kth largest element in the array. 21 | Ex. [-3,5,0,9,4], k = 2 -> return 5 22 | 23 | 24 | ---- 25 | Coding round questions
26 | 27 | - Given a string, check if it is a palindrome by ignoring spaces. E.g. race car would be a palindrome. 28 | - Given two very large strings, consisting of only digits, multiply the two strings and return the result as a string. 29 | - There are n trees in a circle. Each tree has a fruit value associated with it. A bird can sit on a tree for 0.5 sec and then he has to move to a neighbouring tree. It takes the bird 0.5 seconds to move from one tree to another. The bird gets the fruit value when she sits on a tree. We are given n and m (the number of seconds the bird has), and the fruit values of the trees. We have to maximise the total fruit value that the bird can gather. The bird can start from any tree. 30 | - You are given the encoding for a base 58 number. You have to convert all the numbers from 1 to n to a base 58 number using the encoding given. 31 | 32 | 33 | ---- 34 | 35 | 36 | Technical interview questions
37 | Data Structures and Algorithms 38 | 39 | - Converting Decimal Number lying between 1 to 3999 to Roman Numerals.m 40 | - Given an array of distinct elements. The task is to find triplets in the array whose sum is zero. 41 | - Given an array with positive number the task is that we find largest subset from array that contain elements which are Fibonacci numbers. 42 | - Given a string of numbers, the task is to find the maximum value from the string, you can add a ‘+’ or ‘*’ sign between any two numbers. 43 | - Given a string that contains ternary expressions. The expressions may be nested, task is convert the given ternary expression to a binary Tree. 44 | - Given an integer array and a positive integer k, count all distinct pairs with difference equal to k. 45 | - Given a string, find out if the string is K-Palindrome or not. A K-palindrome string transforms into a palindrome on removing at most k characters from it. 46 | - Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 47 | - Given an unsorted array of nonnegative integers, find a continuous subarray which adds to a given number. 48 | - Find the n’th term in Look-and-say (Or Count and Say) Sequence. The look-and-say sequence is the sequence of integers:1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, … 49 | - Given a dictionary, a method to do a lookup in the dictionary and a M x N board where every cell has one character. Find all possible words that can be formed by a sequence of adjacent characters. Note that we can move to any of 8 adjacent characters, but a word should not have multiple instances of the same cell. 50 | - Let 1 represent ‘A’, 2 represents ‘B’, etc. Given a digit sequence, count the number of possible decodings of the given digit sequence. 51 | - Given a square matrix, turn it by 90 degrees in anti-clockwise direction without using any extra space. 52 | - Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity, assume that all bars have same width and the width is 1 unit. 53 | - Given that integers are read from a data stream. Find median of elements read so for in efficient way. For simplicity assume there are no duplicates. 54 | 55 | DBMS 56 | 57 |
58 | Operating System 59 | 60 |
61 | Miscellaneous 62 | 63 | - Design URL Shortener 64 | - Design Messenger 65 | - Design Search Typeahead 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | # Facebook Interview Questions 78 | * [Coding Round Questions](#coding) 79 | ____ 80 | Coding round questions
81 | 82 | - There are N trees in a circle. Each tree has a fruit value associated with it. A bird has to sit on a tree for 0.5 sec to gather all the fruits present on the tree and then the bird can move to a neighboring tree. It takes the bird 0.5 seconds to move from one tree to another. Once all the fruits are picked from a particular tree, she can’t pick any more fruits from that tree. The maximum number of fruits she can gather is infinite. 83 | Given N and M (the total number of seconds the bird has), and the fruit values of the trees. We have to maximize the total fruit value that the bird can gather. The bird can start from any tree.
84 | 85 | - Given two numbers as stings s1 and s2 your task is to multiply them.
86 | 87 | - Find the longest increasing subsequence of a given array of integers, A. 88 | In other words, find a subsequence of array in which the subsequence’s elements are in strictly increasing order, and in which the subsequence is as long as possible. 89 | This subsequence is not necessarily contiguous, or unique. 90 | In this case, we only care about the length of the longest increasing subsequence.
91 | Sample Input: A = 1,2,1,5 92 | Sample Output: 3
93 | 94 | 95 | - A message containing letters from A-Z is being encoded to numbers using the following mapping: 96 | 'A' -> 1 97 | 'B' -> 2 98 | ... 99 | 'Z' -> 26 100 | Given an encoded message A containing digits, determine the total number of ways to decode it modulo 10^9+7.
101 | 102 | -------------------------------------------------------------------------------- /Flipkart/README.md: -------------------------------------------------------------------------------- 1 | # Flipkart Interview Questions 2 | 3 | - [Coding Round Questions](#coding) 4 | - [Technical Interview Questions](#tech) 5 | - [Data Structures and Algorithms](#dsalg) 6 | - [DBMS](#dbms) 7 | - [Operating System](#os) 8 | - [Miscellaneous](#misc) 9 | - [References](#ref) 10 | 11 | --- 12 | 13 | Coding round questions
14 | 15 | - Paths requiring minimum number of jumps to reach end of array 16 | - Find the row having a maximum number of 1s in a binary matrix where each row is sorted. 17 | - Clone a stack without using extra space. 18 | - Design a stack with push pop and find min operations in o(1) time. 19 | - Explain external merge sorting. And try to optimize it if possible. 20 | - Given a string s1 and another string s2, what is the smallest substring in s1 that contains all the characters of s2 ? (most efficient solution) 21 | - Given two list of strings, do the following operations of each pair of strings with same index. 22 | Operation: compute the minimum no. of changes required to make them anagram(rearrange characters of the first string to make another string). 23 | ``` 24 | Eg: (abc,def) = 3 25 | (abc,cde) = 2 26 | (aab,bba) = 1 27 | (aaa,bbb) = 3 28 | ``` 29 | 30 | --- 31 | 32 | Technical Interview Questions 33 |
34 | Data Structures and Algorithms 35 | 36 | - Given set of words which I have to treat as dictionary as new lexicographic order. I have to learn from set of string as print lexicographic order of each character. 37 | - Generate n numbers in ascending order which are having given k factors. Discuss various approaches. Discussed on various approaches. 38 | - Simple dp question that a frog can take 1 or 2 step. Number of ways to reach nth position. 39 | - Given a string s1 from a dictionary and a string s2 from a dictionary, find the minimum number of steps to transform s1 to s2 under the following conditions: 40 | You can change the implementaion of dictionary 41 | Every transformation should belong to the dictionary 42 | You are given a O(1) library function F(s1,s2) which returns True or False for the query ‘can s2 be obtained from s1 with a single transformation’ 43 | - Convert a BST to sorted doubly linked list without any extra space. 44 | - Given an array of integers, for each element find the smallest element bigger than it and is present to its right. (Expected time complexity O(nlogn) 45 | - Given a complete binary tree, such that level order traversal is sorted. Find an element K in this tree efficiently. (Obviously better than O(n)) 46 | - Given an array of sorted integers(both positive and negative), you have to find the square array, which contains a square of each element of the given array in sorted order. 47 | (Expected time complexity O(n)) 48 | - Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a container, such that the container contains the most water. 49 | - You are given three sorted arrays A,B,C. You have to count number of tuples (a,b,c) satisfying a>b>c. a is taken from A, b is taken from B and c is taken from C 50 | - Given NxN matrix. Each cell contains a symbol which is the direction to which you can move from that position. Like if ‘->’ then you can move the left adjacent cell, ‘<-‘ then move to the right adjacent cell and so on for moving upwards and downwards. 51 | Now you would be given start and a end point. You have to find if there is path from start to the end. 52 | - Given an integer array nums, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order. 53 | Return the shortest such subarray and output its length 54 | - Given an n-ary tree, you have to burn all the leaves first. Now, some new leaves will form so you burn them too. Repeat this process until you burn the root node. Your task is to print all the leaves which burn at a time in one line. 55 | 56 | ``` 57 | Eg : 1 58 | / \ 59 | 2 3 60 | / \ / \ 61 | 4 5 6 7 62 | / \ 63 | 8 9 64 | 65 | O/P: 8 9 5 6 7 66 | 4 3 67 | 2 68 | 1 69 | ``` 70 | 71 | - Given an array of integers(both positive and negative), you have to compute the minimum value of abs(sum of all numbers) 72 | You can change the sign of any element any number of times. 73 | 74 | - Given the start and end coordinates of a knight in a chess board, return the minimum number of moves required by the knight to go from the start to the end position. (Knight's movement: move two squares vertically and one square horizontally, or two squares horizontally and one square vertically). If it is impossible to reach the end position, return -1. 75 | 76 | DBMS 77 | 78 | - what tables would you like to used for online shopping like flipkart. He asked the the primary keys for every table and foreign key if there are any. 79 | - He then asked me about mapping of these keys and what type of mapping to be used here(one to one, many to many or many to one). 80 | 81 | Operating System 82 | 83 | - Multithreading and its examples 84 |
85 | 86 | Miscellaneous 87 | 88 | - Projects and Internship 89 | - There are billions of URL given. Come up with a efficient data structure that returns ip address of these urls. 90 | - Print the boundary of a tree. 91 | - Database Mgt System 92 | - Given a large stream of strings, return the top 10 most frequently occurring string . (Hash map + min heap of size 10 is the solution.) 93 | - Trie data structure 94 | -------------------------------------------------------------------------------- /Google/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Google Interview Questions 3 | 4 | * [Telephonic Round Questions](#quiz) 5 | * [Coding Round Questions](#coding) 6 | 7 | ____ 8 | 9 | 10 | Telephonic Round Questions
11 | 12 | - What is the approximate value of 2 to the power of 24? 13 | - The average and worst-case time complexity of Merge Sort and Quick Sort. 14 | - What does the *.find()* function of C++ Collection return when the item is not there in the collection. 15 | - Mention few implementations of Map interface in Java. 16 | - What is the advantage of using Heapsort over Mergesort? 17 | - Assume you're using a program which uses dynamic memory allocation and you're working with a libary which does not have malloc function.How would you implement your own malloc function? 18 | - which data structure is used to implement DFS and which one is used for BFS? 19 | - what is the lookup time for a HashSet? 20 | - Heap is implemented using which data structure? 21 | - which sorting algorithm is best in terms of time complexity? 22 | - Immutable data structure among these: tuples, lists, dictionaries 23 | - Minimum height of the binary tree of 800 nodes? 24 | - What is the method used to cut spaces from front and back of a string in Python? 25 | ____ 26 | 27 | 28 | Coding round questions
29 | 30 | - Given (x, y) coordinates, create a function such that each coordinate is uniquely mapped to an integer. Also make sure that given an integer, you should be able to find (x, y) coordinates. So F(x, y) = z and also that inverse F(z) = (x, y). 31 | - You are given an array of million numbers and provided a range of index (say left, right). For multiple queries, each with input left and right indexes, output the maximum in that range. 32 | - Given an expression tree (a tree with mathematical operations as the root and left children, and the numbers as the leaves) calculate and return the value of the whole mathematical expression. 33 | - Given an array of integers arr[], find the number of recycled pairs in the array. A recycled pair of two numbers {a, b} has the following properties : 34 | 35 | A should be smaller than B. 36 | Several digits should be the same. 37 | By rotating A any number of times in one direction, we should get B. 38 | 39 | - We have to paint n boards of length {A1, A2, .. An}. There are k painters available and each takes 1 unit time to paint 1 unit of the board. The problem is to find the minimum time to get this job done under the constraints that any painter will only paint continuous sections of boards, say board {2, 3, 4} or only board {1} or nothing but not board {2, 4, 5}. 40 | - Given a valid sentence without any spaces between the words and a dictionary of valid English words, find all possible ways to break the sentence in individual dictionary words. Sample input-output is as follows:
41 | Sample Input: {i, like, sam, sung, Samsung, mobile, ice, cream, icecream, man, go, mango}, "ilikesamsungmobile"
42 | Sample Output: I like sam sung mobile 43 | I like Samsung mobile 44 | 45 | - Given two integer arrays A and B of size N.
46 | There are N gas stations along a circular route, where the amount of gas at station i is A[i].
47 | You have a car with an unlimited gas tank and it costs B[i] of gas to travel from station i
48 | to its next station (i+1). You begin the journey with an empty tank at one of the gas stations.
49 | Return the minimum starting gas station’s index if you can travel around the circuit once, otherwise return -1.
50 | You can only travel in one direction. i to i+1, i+2, … n-1, 0, 1, 2.. Completing the circuit means starting at i and 51 | ending up at i again.
52 | 53 | - Given a string A, partition A such that every substring of the partition is a palindrome.
54 | Return the minimum cuts needed for a palindrome partitioning of A.
55 | Sample Input: "aba" 56 | Sample Output: 0 57 | - Given a map containing employee to manager mappings, find all employees under each manager who directly or indirectly reports to him.
58 | For example, consider below employee-manager pairs :
59 | Sample Input: A->A
60 | B->A
61 | C->B
62 | D->B
63 | E->D
64 | F->E
65 | Sample Output: A-> B, D, C, E, F
66 | B-> D, C, E, F
67 | C->
68 | D-> E, F
69 | E-> F
70 | F->
71 | -------------------------------------------------------------------------------- /Grab/README.md: -------------------------------------------------------------------------------- 1 | # Grab Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [DBMS](#dbms) 6 | * [Operating System](#os) 7 | * [Miscellaneous](#misc) 8 | * [References](#ref) 9 | ____ 10 | Coding round questions
11 | - In an integer array, find a pair of numbers which add up to a given number. 12 | - Write a function that add 1 to LinkedList number 13 | ``` 14 | [2]->[4]->[5]->[7]->[3]->[6] 15 | after plus 1 16 | [2]->[4]->[5]->[7]->[3]->[7] 17 | ``` 18 | - Find the count of all perfect squares between two numbers a and b. 19 | - Given an array of N integers, find the longest leading fragment of the array which contains equal no. of X and Y. Expected time complexity is O(n). 20 | - There're 3 kinds of the bus ticket. 21 | 1: ticket 1 cost 2 and can be used for a day. 22 | 2: ticket 2 cost 7 and can be used for a consecutive 7 days. 23 | 3: ticket 3 cost 25 can be used for a month. Assume month here means 30 consecutive days. 24 | 25 | Now there's an array filled with elements. Each element value is a date for a person to travel. This array has already been sorted in ascending order, like {1,3,4,5,11,12,23,24,30}. 26 | The final day is 30th and the first day is 1st. 27 | 28 | So for any given array from a person to travel, how can this person cost least? 29 | - Given N rows of seats in a movie theatre, each row with seats labelled A to K some seats are reserved. A 3 person family want seats next to each other (seats across the aisle is not allowed), return all available options. 30 | 31 | Reserved seat will be given like "1A 2B 40G". 32 | - Design a class to calculate the moving average of last N numbers in a stream of real numbers. 33 | - Format a string of numbers to display a currency - example" "1234.678" to "1,234.68". 34 | - Given an array find the next greater element. 35 | - Find the distance between any two nodes of the tree. 36 | - There is NPM JSON API for getting NPM packages info. For example, the following URL allows for getting information about the latest version of "forever" package: 37 | http://registry.npmjs.org/forever/latest 38 | This request will result in a JSON, containing many fields, including dependencies field: 39 | ```dependencies: { 40 | cliff: "~0.1.9", 41 | clone: "^1.0.2", 42 | colors: "~0.6.2", 43 | flatiron: "~0.4.2", 44 | forever-monitor: "~1.7.0", 45 | ... 46 | } 47 | ``` 48 | 49 | This is a list of direct dependencies of an NPM package. 50 | 51 | Write a function getAllDependencies(packageName) which takes in packageName parameter as a string and returns an array of strings of both direct and all indirect (recursive) dependencies of the given package, fetched from the API described above. For example, if A depends on B, and B depends on C and D, getAllDependencies('A') should return ['B', 'C', 'D']. The result should not contain duplicates. 52 | 53 | In a correct implementation, getAllDependencies("forever") should return an array with length about 200+ (as of the time we wrote this question and might be different in the future). 54 | 55 | Include a list of tools that need to be installed to run your code and instructions on how to run your program. 56 | 57 | NOTE: 58 | 59 | 1. Don’t try to code your solution in a browser environment, the response from NPM API will not pass CORS checks in the browser. 60 | 2. You should not care about package versions (only need the latest). 61 | 3. You should not care about the development of dependencies. 62 | 4. The function should return the array (or a promise of the array if your function is async), instead of just printing the result. 63 | 64 | Base level expectations: 65 | 66 | Code correctness 67 | Code readability 68 | Error-handling: do not assume your calls to the endpoint will always succeed 69 | 70 | Bonus points for: 71 | 72 | Use of concurrency 73 | - Find the total number of heaps that could be formed with n distinct integers. It has a dynamic programming approach. 74 | - Write a program which takes JSON as input and gives prettified JSON. 75 | 76 | ---- 77 | Technical Interview Questions 78 |
79 | Data Structures and Algorithms 80 | - Minimum Element in Stack. 81 | - Top view of the tree. 82 | - Flip the ith bit without using ~. 83 | - Queue using two stacks. 84 | - Right view of a binary search tree. 85 | - Find out the last nth node in a linked list. 86 | - Write code for column-wise tree traversal. 87 | - Reverse a sentence of words. 88 | - How do you check that a given binary tree is a valid balanced binary search tree? 89 | - You receive a bitstream (0 and 1). Continuously receive a stream of bit, each time, you have to determine whether the current value is divisibility by 3 and print True or False. 90 | - Given an array of unsorted positive integers, find the length of maximum subarray containing consecutive integers. 91 | 92 |
93 | DBMS 94 | 95 | - DB Concurrency. 96 |
97 | Miscellaneous 98 | 99 | - What is the use of join() and yield() in Thread? 100 | - What is a singleton class and how to protect it from reflection? 101 | - Explain JVM architecture. 102 | - What is a Stack Frame? 103 | - What are dockers and containers? 104 | 105 | 106 | ---- 107 | References 108 |
109 | - Geeksforgeeks 110 | -------------------------------------------------------------------------------- /Groupon/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Intel/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Intel Interview Questions 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [Miscellaneous](#misc) 9 | * [References](#ref) 10 | ____ 11 | Coding round questions
12 | - Design a stack in which we should push and pop at both the ends (30 min) 13 | Solve the same using Linked List and Arrays. 14 | Write test case to verify your code. 15 | - Design autonomous driving car. (30 min) 16 | They were checking how deep we can think and consider all the possible use cases and scenarios 17 | - A simple code on brute force approach, Given a hotel check-in and checkOut list(of a month) containing a number of persons check-in and checkOut on each and every day, find out the days which has maximum check-in and maximum CheckOut? 18 | - Design a stack with push pop and find min operations in o(1) time. 19 | - Explain external merge sorting. And try to optimize it if possible. 20 | - Given a string s1 and another string s2, what is the smallest substring in s1 that contains all the characters of s2 ? (most efficient solution) 21 | --- 22 | Technical Interview Questions 23 |
24 | Data Structures and Algorithms 25 | - Write the most efficient algorithm to find square/square root of a number. 26 | - Write the most efficient algorithm to find if a number is prime or not. 27 | - At Bit level, how will you find if a number is a power of 2 or not. 28 | - reverse a linklist both way iterative and recursive 29 | - How would you check whether stack space is overflowed or not? 30 | - Which part of the memory is allocated, when malloc and calloc are called for any variable? 31 | 32 | DBMS 33 | - What are the major data structures used in the following areas: RDBMS, Network data model, and Hierarchical data model. 34 | - What do you mean by Correlated subquery?. 35 | 36 | Operating System 37 | - What is a semaphore? Explain in detail. 38 | - What is an interrupt. How does a processor handle an interrupt? 39 | - What is the exact role of Memory Management Unit? 40 | - they asked os concepts like scheduling, paging, segmentation, virtual memory, physical memory, cache, thread, semaphor etc. 41 | - What are cache and TLB? 42 | - How would you measure the stack space without using the task manager, when an application is running on a computer? Write an algorithm if possible 43 | - When a game is running on a computer, what are the resources it will use on a computer? Firmware, Middleware, drivers, Application characteristics, stack 44 |
45 | 46 | Miscellaneous 47 | - Projects and Internship 48 | - What do you mean by Network and Switching Subsystem? 49 | - Tell me about your M.Tech project? 50 | - Tell me about your M.Tech Mini Project? 51 | - Tell me about your recent project? 52 | 53 | -------------------------------------------------------------------------------- /Intuit/README.md: -------------------------------------------------------------------------------- 1 | # Intuit Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [References](#ref) 6 | ____ 7 | Coding round questions
8 | - You have been two integers n and m where n is the size of the array and m is the number of the edges. The next line contains an array of size n and next m lines contain two integers x and y each which represents that there exists a bidirectional edge between x and y. We have to output the number of permutations of the array which are lucky. A permutation is said to be lucky if for every Vi in the array there exists an edge between Vi and Vi+1. 9 | 10 | 11 | 12 | Eg Input : 3 2 Output : 2 ( 1-2-3 and 3-2-1) 13 | 14 | 1 2 3 15 | 16 | 1 2 17 | 18 | 2 3 19 | 20 |
21 | 22 | - You have been an integer n and an array of size n as input. You have to print the count of special numbers in an array. A number is said to be special if it is divisible by at least one other element of the array. 23 | 24 | Eg: Input: 3 Output: 2 ( 2 and 3 because they are divisible by 1) 25 | 26 | 1 2 3 27 | 28 |
29 | 30 | - You have been given an mXn matrix and an integer k as input. You have to print the count of all the submatrices of the current matrix whose sum is divisible by k. 31 | 32 | Eg Input: 2 2 2 Output: 5 ( [1,3], [2,4], [2], [4], [1,2,3,4] ) 33 | 34 | 1 2 35 | 36 | 3 4 37 | 38 |
39 | 40 | - You have been given an integer n and a string of length n. You have to find the longest palindromic substring for every prefix of the given string. 41 | 42 | Eg. Input: 5 Output: 1 1 3 3 5 43 | 44 | a b a b a ( a: 1, a b: 1, a b a: 3, a b a b: 3, a b a b a: 5) 45 | 46 |
47 | 48 | ---- 49 |
50 |
51 | -------------------------------------------------------------------------------- /JP Morgan Chase/README.md: -------------------------------------------------------------------------------- 1 | 2 | # JPMC QR Interview Questions 3 | 4 | * [Telephonic Round Questions](#quiz) 5 | * [Coding Round Questions](#coding) 6 | 7 | ____ 8 | 9 | 10 | Virtual Interview Round Questions
11 | 12 | * Interview Round 1 13 | - Return the kth sorted element from an unosrted array, provided that you cannot sort the complete array. 14 | Approach : Apply Quicksort, taking elements partially - each time need to check if the pivot (chosen as last element) is on the (n-k-1)th position or not. 15 | - You are given a rectangle with sides of lengths X and Y, given that X and Y are both independent random variables from the same probability distribution. You are also given a square with side length as X. Compare the expected areas of both the figures. 16 | Approach : Area of rectangle = XY => expected value = E(XY) = E(X)E(Y) = u^2 (u = mean of distribution) 17 | Area of square = X^2 => expected value = E(X^2) => apply formula of variance to get a relation and then compare. 18 | - Given an equation : sinx = 5. solve for x. 19 | Approach : Apply Euler's Formula. 20 | - Given a graph, find the minimum number of colours using which it can be coloured. 21 | Approach : Consider a adjacency matrix representation of the graph, with 1 representing edges between nodes and 0 otherwise. Applying DFS, we can color all the connected components - all the 1s should be colored. So the problem reduces to finding the number of islands of 1s. Important thing to consider - since minimum number is asked, you need to take 'adjacent' 1s in all 8 directions and not just the ones with common edge. 22 | 23 | * Interview Round 2 24 | - What is a friend function in C++? 25 | - What is the difference between references and pointers? 26 | - How to add two integers without using addition operator? (Hint : apply bit manipulation) 27 | - What is the expected value obtained upon rolling a dice? 28 | - Given a dice, what will be the expected payoff for two rolls? (Payoff means the value obtained, you can only take the value of the last roll. You may choose to stop after 1 roll if you so desire.) 29 | - Time complexities of insertion sort, selection sort, counting sort and when they should be used. 30 | 31 | * Interview Round 3 32 | - Given a sequence, determine whether it is converging or diverging. 33 | - Given two strings, tell whether they follow a similar pattern or not. 34 | example : 'abb' and 'fzz' follow a pattern, but 'abc' and 'fzz' do not. Similarly, 'abca' and 'fggf' do not. 35 | Hint : come up with a suitable hashing function. 36 | ____ 37 | 38 | 39 | Coding round questions
40 | 41 | - Given a sorted array find the length of the longest Arithmetic Progression. 42 | example : 1 4 5 7 8 10 -> longest AP : 1, 4, 7, 10 => return 4. 43 | 44 | - Longest Increasing Subsequence 45 | 46 | - Aptitude Questions -> CS theory, Probability, Linear Algebra 47 | 48 | - Given an int, print 1 if the number of occurrences of current index and element at this index is same, else print 0 49 | Ex. 22 -> 0 50 | Ex. 2020 -> 1, because 0: there are 2 zeroes, 1: there is 0 ones, 2: there are 2 twos, 3: there is 0 threes 51 | 52 | - Given a string of shuffled numbers (in the string form), print the corresponding integer in a sorted way 53 | Ex. neo -> 1 54 | Ex. rneheetotow -> 123 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Rishabh Maurya 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LinkedIn/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # LinkedIn Interview Questions 4 | * [Coding Round Questions](#coding) 5 | * [Technical Interview Questions](#tech) 6 | * [Data Structures And Algorithms](#dsalg) 7 | * [Miscellaneous](#misc) 8 | 9 | ____ 10 | Coding round questions
11 | 12 | * Given a binary search tree and a key, if key is found in tree, return 1 else -1. 13 | 14 | * Given a string, find the number of distinct substrings (should optimise time and space complexity) 15 | 16 | * Given a string, find the number of distinct palindromic substrings (should optimise time complexity) 17 | 18 | ____ 19 | Technical Interview Questions 20 |
21 | Data Structures and Algorithms 22 | * Given a boolean expression, find the number of ways to parenthesise it so that it evaluates to true. 23 | 24 | * Optimal Strategy for a Game. 25 | (You are given an array A of size N. The array contains integers and is of even length. The elements of the array represent N coin of values V1, V2, ....Vn. You play against an opponent in an alternating way. In each turn, a player selects either the first or last coin from the row, removes it from the row permanently, and receives the value of the coin. 26 | You need to determine the maximum possible amouint of money you can win if you go first.) 27 | 28 | * Given n stairs , you climb 1 , 2 or 3 stairs at a time . Find the number of ways to reach the nth step. 29 | 30 | * Given the pointer to the root of the tree and two values val1 and val2 . Find the length of path between the values val1 and val2 in the binary tree. { handle corner cases where both the values are on the same path} 31 | 32 | * Given a mapping between numbers and alphabets. find the number of ways to decode a sequence of numbers 33 | 34 | * Given a matrix of 0 s and 1 s Find the number of connected components having 1s 35 | 36 | * Given a tree check if it is a binary search tree or not constraints: space complexity O(1) 37 | 38 | Miscellaneous 39 | * Asked questions on my resume and challenges faced in my project. Other behavioral question. 40 | -------------------------------------------------------------------------------- /MakeMyTrip/README.md: -------------------------------------------------------------------------------- 1 | ## MakeMyTrip Interview Questions 2 | * [Telephonic Round Questions](#telephonic) 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [Miscellaneous](#misc) 9 | * [References](#ref) 10 | ____ 11 | Coding round questions
12 | 13 | - Given an Array of integers and an integer K and indexes L and R. You have to find an element that is most repeated in between L and R when array is repeated k-1 times. 14 | 15 | - Given a pair of coordinates (X1, Y1)(source) and (X2, Y2)(destination), the task is to check if it is possible to reach the destination form the source by the following movements from any cell (X, Y): 16 | 17 | (X + Y, Y) 18 | (X, Y + X) 19 | Note: All coordinates are positive and can be as large as 1018. 20 | 21 | - Given a list of string url's, sort them according to their count and when two strings have same count sort them lexicographically. 22 | 23 | - You are given an array of numbers and for each ith element in the array you have to calculate the absolute difference between the count of numbers that are to the left of i and are greater than ith element, and the count of numbers that are to the right of i and are lesser than ith element? 24 | 25 | - Given a String S1 and String S2. Convert string S1 to a palindrome string such as S2 is a substring of that palindromic string. The only operation allowed on S1 is the replacement of any character with any other character. Find the minimum number of operations required. 26 | 27 | - You are given a tree with N nodes and Q queries. Next line contains N integers representing the color associated with each ith node. For each query you are given a node numbers. Now you have to mark all nodes as special which are in its subtree and have the same color as this node.Once a node is marked special, it remains special in the subsequent queries. So for each query you have to output the number of special nodes in the tree. 28 | 29 | ---- 30 | Technical Interview Questions 31 |
32 | Data Structures and Algorithms 33 | 34 | - Find the Longest palindromic substring in the given string. 35 | 36 | - Given a matrix of dimension m*n where each cell in the matrix can have the value 0 which represents empty cell, 1 which represents cells have fresh oranges and 2 which represents cells have rotten oranges.Determine minimum time required so that all oranges become rotten. A rotten orange at index (i, j) can rot fresh oranges at (i-1, j), (i+1, j), (i, j-1), (i, j+1). 37 | 38 | - Connect nodes at the same level of a binary tree given extra next pointer. 39 | 40 | - To design a data structure for a question bank. Each question has an ID and a text, both strings. The data structure should support insertion, deletion, search, and get random question with O(1) time complexity. 41 | 42 | - Next greater element for every element in an array. 43 | 44 | - Left view of a binary tree. 45 | 46 |
47 | DBMS 48 | 49 | - Differences between B TREES and B+ TREES. 50 | 51 | - Difference between RDMS and NoSQL. 52 | 53 | - Difference between Thread and Process. 54 | 55 | - 16 GB RAM, 256 GB Hard Disk and there are two csv files such as one is a customer file of 100MB having (customer ID, customer name) and other is a order file of 200GB having (order ID, customer ID and some order related details). Task is to inner join those two files based on customer ID with using SQL. 56 | 57 | - Difference between primary and foreign keys. 58 | 59 |
60 | Operating System 61 | 62 | - Questions in this section. 63 |
64 | Miscellaneous 65 | 66 | - What happens when you type the URL in your browser? 67 | -------------------------------------------------------------------------------- /Media.net/README.md: -------------------------------------------------------------------------------- 1 | # Media.net Interview Questions 2 | 3 | Coding round questions
4 | 5 | - Given the list of money you either gave or took from your friends. Find the name of friend whom you have to pay max amount. If you have taken money then value will be positive or if you have given money value will be negative. If more than 1 friend have max amount then print the name of friend who achieved equal to or more than max amount the earliest. (this is available on GeeksForGeeks) 6 | 7 | - You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it. All of the tickets belong to a man who departs from "JFK", thus, the itinerary must begin with "JFK". If there are multiple valid itineraries, you should return the itinerary that has the smallest lexical order when read as a single string. 8 | For example, the itinerary ["JFK", "LGA"] has a smaller lexical order than ["JFK", "LGB"]. 9 | You may assume all tickets form at least one valid itinerary. You must use all the tickets once and only once. (this is available on LeetCode) 10 | 11 | 12 | - There are many people who believe that the earth is flat and NASA is a scam. They call themselves Flat Earthers. They were already worried that the 6 feet social distancing rule might push some people out of the earth. Now, they decided to think about a new issue. Since the earth is flat ( or so they think), let's imagine it as an infinite 2D grid. They have the coordinates of certain points which are orange zones and have some COVID-19 cases reported. Now each day the orange zones become more fatal. After d days, all the locations within a euclidean distance of d of a particular orange zone can be affected by this zone. 13 | They know N orange zones, each of whose coordinates are given by (A[i][0], A[i][1]). Now, a location is considered a red zone if it is affected by at least B orange zones. You need to find the first day at which the first red zone is reported. (this is available on InterviewBit) -------------------------------------------------------------------------------- /Microsoft/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Microsoft Interview Questions 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [System Design](#design) 9 | * [Miscellaneous](#misc) 10 | * [References](#ref) 11 | 12 | ____ 13 | Coding round questions
14 | 15 | - Write a program to check if a binary tree is BST or not. 16 | - Write a program to reverse digits of an integer. 17 | - Write a function that calculates the day of the week for any particular date in the past or future. 18 | - Given a binary tree and data value of a node. The task is to find the sum of cousin nodes of a given node. If the given node has no cousins then return -1. 19 | -Given a positive number N. The task is to round N to the nearest multiple of 10. The number can be so big and can contain 1000 of digits. 20 | - At an ATM Machine, you are given an amount to withdraw and some denominations of the Notes available in the ATM Machine. Find the number of ways in which you can withdraw the amount. 21 | - You are given 2 Linked List where each List represents a number, i.e if the linked list of length 3 is represented as 2->4->1 then it represents the number 241. You need to implement a function that computes the sum of these 2 numbers(represented as a linked list) and the resultant number should also be represented as a linked list. 22 | - Implement a function that accepts two integers arrays 'arr1' and 'arr2' of sizes n and m respectively as its argument to find and return the sum of all uncommon elements in two arrays(elements which are present in only one of the array). Return -1 if both arrays are null. If one of the arrays is null then return the sum of all elements of the other array. 23 | - A function accepts 2 int arrays - value array 'valarr' and index array 'indexarr', both of length 'l', as its arguments. Implement the function to permute the given value array according to the index array provided. Return the modified value array from the function. 24 | - Given a string of consecutive digits and a number Y, the task is to find the number of minimum sets such that every set follows the below rule: 25 | 1. Set should contain consecutive numbers 26 | 1. No digit can be used more than once. 27 | 1. The number in the set should not be more than Y. 28 | - Given two numbers n,m find a number closest to n and divisible by m. 29 | - Given a string consisting of only 0,1,A,B,C where A=AND B=OR and C= 30 | XOR. Calculate the value of the string moving from left to right assuming no order of precedence. 31 | - Find length of longest AP in given set of numbers. 32 | - Reverse words in a given string 33 | - Given an array that contains both positive and negative integers, find the product of the maximum product subarray. Expected Time complexity is O(n) and only O(1) extra space can be used. 34 | - Given an array. Values of the array are memory sizes and the memory that is required by the system can only be represented in powers of 2. Return the size of the memory required by the system. Eg: – arr = {2,1,4,5} ,Total = 12. So, memory required =16. 35 | - Given two strings, modify 1st string such that all the common characters of the two strings are removed and the uncommon characters of the 2nd string are concatenated with uncommon characters of the 1st string. Eg: String 1 - 'aacdb' , String 2 – 'gafd' & Output – cbgf. 36 | - Given a linked list, segregate its even and odd position nodes in such a way that odd position nodes before even positioned nodes and even positioned nodes are appended after odd positioned nodes but in a reverse order. Eg: linked list: – 1 -> 2 -> 3 -> 4 -> 5 -> 6 , Output: – 1 -> 3-> 5 -> 6 -> 4-> 2. 37 | - Given a JSON string find the max depth of the string. 38 | - Given n dice and each face has value from 1 to x. Calculate the number of ways a value SUM can be obtained by rolling those dice. 39 | - Evaluate an infix expression in one pass without converting to postfix notation. 40 |
41 | 42 | ---- 43 | Technical Interview Questions 44 |
45 | 46 | Data Structures and Algorithms 47 | 48 | - Given two expressions in the form of a tree. Where each node is either a token or an operator. Check if the given expressions are same. Tokens can not be compared i.e their value in not defined. And the operator behaves similar to addition having properties like commutative and associative. 49 | - Design a data structure similar to dictionary. 50 | - Given N rectangles in a 2-D and the (x, y) coordinates of the bottom left corner of each rectangle and height and width of each rectangle. Return (x, y) coordinates of the bottom left corner of overlapping rectangle and also give its height and width. 51 | - N flight tickets are given, create the route using these pairs of points from source to the destination. 52 | - N elements are given and N is very large. Print the smallest element. 53 | - Given a rectangle of size AxB, find minimum number of squares that could be formed from that particular rectangle. 54 | - Implement queue (class) and implement Enqueue and Dequeue functions in the class. Make the class thread safe. If this queue is used by N machines and each machine has its own view of the queue, how will you maintain the consistency. 55 | - Boundary Traversal of binary tree to print only alternate nodes. 56 | - Given a number n, find the minimum number of squares that sum to X. A number can always be represented as a sum of squares of other numbers. 57 | - Given an n x n matrix, where every row and column is sorted in increasing order. Given a key, how to decide whether this key is in the matrix. 58 | - Given, a sorted array pivoted (rotated by some number) at some point, find the position of a given element. 59 | - Given, an array of integers what will be the maximum OR value? Find the smallest subset that gives the maximum OR value? 60 | - Given a BST, find the distance between 2 nodes whose values are given. 61 | - How will you delete a node in a doubly-linked list? 62 | - Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. 63 | - Implement a DS that supports 3 operations. 64 | 1. Insert 65 | 2. Delete 66 | 3. Get Random Element (Return a uniformly random element from the set of elements) 67 | It is guaranteed that the elements are unique. Implement the DS such that it supports all these operations in O(1) time. 68 | - Given a matrix find a submatrix with the maximum sum. 69 | - Given a row-wise and column-wise sorted matrix find a given element. 70 | - Find the lowest common ancestor of a binary tree which has links to its parents. 71 | - Partition an array into two disjoit subsets so that they have minimum absolute difference of their sums. 72 | - Calculate Height of a Binary Tree. 73 | - Given an un-directed graph, find if the graph contains any cycle. 74 | - Find if an array is subset of another array. 75 | - Suggest DS for text prediction and spell check. Follow up to this were - 76 | 1. Write the implementation of Trie. 77 | 2. How can you reduce the space complexity of Trie? 78 |
79 | 80 | DBMS 81 | 82 | - Difference between Vertical and Horizontal Scaling. 83 | - Sharding 84 | - Indexing in DBMS. 85 | - Joins in DBMS 86 |
87 | Operating System 88 | 89 | - Deadlock in OS 90 | - Difference between Process and thread 91 | - Thrashing in OS 92 | - Difference between virtual addressing and translation lookaside buffer(TLB) 93 | - As a developer how would you make your programs knowing the fact that the system implements paging. 94 | - How is deadlock created? 95 | - Talk about Semaphores and Critical Section. 96 | - Different types of Job Scheduling algorithms? What is starvation? 97 |
98 | 99 | System Design 100 | 101 | - How is a URL shortened? 102 | - Define the LRU cache and what data structure would you use to implement it? 103 | - Questions based on locked transactions in the banking sector. What will happen if 2 transactions are being made from the same account exactly at the same time? What are the different checks made by the bank to keep a check on frauds? 104 | - Design an elevator system 105 | - Design a service or tool that monitor the number of requests per a window time a service agrees to allow. If the number of request exceeds the rate limiter blocks all the excess calls. 106 | - Design a Restaurant Management System. 107 | - You are in charge of writing a software for a slot machine. On press of a button, the slot machine should output the roll of 2 dice. Constraints: Do not use the random library and secondly the probability of the dice rolls should be equal. 108 | - Design a T9 Keypad predictor. i.e, you just write the numbers and it shows at most 5 suggestions of words that can be formed , or words having this as a prefix. 109 | - Design 'Ride Now' feature in Ola Ride App. 110 | - Low level design of employee-manager "out-of-office" status provider that returns details of an employee if working on a given day otherwise keep going up the heirarchy of their managers until one is available. 111 | - Design camera class present in smartphones in such a way that multiple instances of that object are not created everytime camera is accessed. 112 | - Design a class that returns correct payment object when one of different types of payment methods (credit card, debit card, netbanking, UPI...etc) is given as input. 113 |
114 | 115 | Miscellaneous 116 | 117 | - Projects and Internship 118 | - Challenges faced in the college life 119 | - Extra-curricular activities 120 | - Given two very big numbers (each more than 500 digits), multiply them. 121 | - Three Qualities why we should hire you? 122 |
123 | 124 | ---- 125 | References
126 | 127 | - [Geeksforgeeks](http://www.geeksforgeeks.org/) 128 | - [Leetcode](https://leetcode.com/) 129 | 130 | -------------------------------------------------------------------------------- /Mindtickle/README.md: -------------------------------------------------------------------------------- 1 | # Mindtickle Interview Questions 2 | 3 | - [Coding Round Questions](#coding) 4 | - [Technical Interview Questions](#tech) 5 | - [Low Level Design](#lld) 6 | 7 | --- 8 | 9 | Coding round questions 10 |
11 | 12 | -Rotten Tomatoes in a 2d matrix. (Hint : Use BFS) 13 | 14 |
15 | 16 | Technical Interview Questions 17 |
18 | Data Structures and Algorithms 19 | 20 | -Shortest Path in a grid. (Hint : Use BFS) 21 | -Trapping Rain Water without two pointer approach. (Hint : Use stacks) 22 | 23 |
24 | Low Level Design 25 | 26 | - Design Ludo game. (Must Have : Essential Class seperation, Good Method signature and Class wise roles) {SOLID Principle} 27 | - Design Chess game. Implement the logic for Knight movement. Track Old Moves for statergy pattern. {SOLID Principle} 28 | 29 |
-------------------------------------------------------------------------------- /MobiKwik/README.md: -------------------------------------------------------------------------------- 1 | # Mobikwik Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [DBMS](#dbms) 6 | * [Operating System](#os) 7 | * [Miscellaneous](#misc) 8 | * [References](#ref) 9 | ____ 10 | Coding round questions
11 | - Given an array of distinct elements, rearrange the elements of an array in zig-zag fashion in O(n) time. The converted array should be in form a < b > c < d > e < f. 12 | - Find k max in an array and print it. 13 | - Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces. 14 | - You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. 15 | - Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. 16 | - Convert string to palindrome string with minimum insertions. 17 | - Given a matrix of n*n. Each cell contain 0, 1, -1. 0 denotes there is no diamond but there is a path. 1 denotes there is a diamond at that location with a path -1 denotes that the path is blocked. Now you have started from 0,0 and reach to the last cell & then return to 0,0 collecting maximum no of diamonds. While going to the last cell you can move only right and down. While returning you can move only left and up. 18 | - Build a super stack. 19 | 20 | Print value of "peak" after each operation. 21 | n: the number of operations 22 | POP: get the value of "peak", if there is no more value after the pop, 23 | then print "EMPTY". 24 | PUSH d: put the new value(d) after "peak", then print the value of "peak". 25 | INC x d : add the new value(d) from index 0 to x elements, then print 26 | the value of "peak". 27 | - Given a graph of connected and unconnected cities and cost for connecting unconnected cities were provided and we were asked to find minimum cost to connect all cities. 28 | ---- 29 | Technical Interview Questions 30 | 31 | Data Structures and Algorithms 32 | - Given a binary tree, print its top, bottom left and right view. 33 | - Implement queue with two stacks. 34 | - Level order traversal. 35 | - Find the LCA of two nodes in BST. 36 | - Find successor and predecessor of a node in BST. 37 | - Write a program for solving the Tower of Hanoi problem. 38 | - Write a program for string reversal through recursion. 39 | - WAP to reverse Doubly LL. 40 | - From a given string find the maximum length substring which is a palindrome. 41 | - Kruskal's MST algorithm. 42 | - Dijkstra's Algorithm. 43 | - Write codes for Heap sort, Radix sort and Merge sort. 44 | - Find whether the linked list has a loop or not. 45 | - Find the meeting point of the loop in a linked list. 46 | - Reverse a linked list by recursion. 47 | - Reverse a stack without using extra memory. 48 | - Make a balanced BST from the given sorted linked list. 49 | - Given a string, find the maximum substring having an equal number of 1's an equal number of 0's. 50 | - Find the total number of ways in which 2 x N strip can be filled with 2 x 1 brick. ( O(log n)). 51 | - Find the elements having the sum equal to k from BST in O(n) time complexity. 52 | - Find the maximum square submatrix from a given matrix filled with only '1'. 53 | - Find 35/3 without using recursion. 54 | 55 | DBMS 56 | - Make a normalised database of Student Database in college, right from ER to normalized relational database. 57 | - The foreign key, primary key and the entity types. 58 | - Indexing, clustering and joins. 59 | - Write a query for the maximum number. 60 | - Difference between the “having by” and “group by”? 61 | 62 | 63 | Miscellaneous 64 | - Principle of OOPS. 65 | - Multithreading in Java. 66 | - What is serialization? 67 | - Briefly explain DNS, TCP, UDP, OSI layer. 68 | - Why there is some null interface in java? What does it mean? Give me some null interfaces in JAVA? 69 | - What is JNI? 70 | - What is a compilation unit? 71 | - Is string a wrapper class? 72 | - Why Java is not 100 objects oriented language? 73 | - What is a resource bundle? 74 | - Is Iterator a Class or Interface? What is its use? 75 | - Why do threads block on I/O? 76 | - What is synchronization and why is it important? 77 | - How class level lock is acquired? 78 | - Is null is a keyword in Java? 79 | - What is checked and unchecked exceptions? 80 | - Does garbage collection guarantee that a program will not run out of memory? 81 | - What restrictions are placed on the location of a package statement within a source code file? 82 | - What is the immediate superclass of the Applet class? 83 | - What is the size of an empty class in C++ and Java? Why is it not zero? sizeof(); returns 1 in the case of C++. 84 | - Explain compile time polymorphism and runtime polymorphism. 85 | - What is the reason for single inheritance in Java? 86 | - What is the reason for single inheritance in Java ? 87 | - How to compute 33/5 without using ‘/’, ‘%’ and ‘*’ operator. 88 | -------------------------------------------------------------------------------- /NEC Technologies/README.md: -------------------------------------------------------------------------------- 1 | # NEC Technologies Interview Questions 2 | #### Profile: Member of Technical Staff 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [Miscellaneous](#misc) 9 | * [References](#ref) 10 | ____ 11 | Coding round questions
12 | - Display all numbers between 32-62 which ends with 5. 13 | - Write a program that accepts a decimal number and outputs the binary representation of that number. 14 | - Given ASCII values, output the string. 15 | - You are given an m x n 2D matrix. Rotate the image by 90 degrees (anti-clockwise). 16 | - Write a program to convert infix to postfix. 17 | - Write a program to print transpose of a given matrix. 18 | - Given a 2D array, find the maximum sum subarray in it. 19 | - Given a binary search tree, write a function kth smallest to find the kth smallest element in it. 20 | - Given a text file, I want the words to be scanned from it, along with their occurrences, sort them in descending order, & display the top 10 words. 21 | - Find the second-largest number. 22 | - Find whether two strings are an anagram of each other. 23 | - Find missing number unsorted contiguous array. 24 | - Find Number of common Guests in all parties if the user gives the input in the following format. 25 | The guest's list for parties is in one line separated by Comma(,). 26 | ``` 27 | 28 | Input: 122,444,2223,122,1111,122,2233,123,333,333,444, 29 | 1111,122 30 | Output: 31 | 2233:1 32 | 2223:1 33 | 333:2 34 | 444:2 35 | 1111:2 36 | 122:4 37 | 123:1 38 | 39 | ``` 40 | 41 | 42 | 43 | ---- 44 | Technical Interview Questions 45 |
46 | Data Structures and Algorithms 47 | - Write a recursive function to print reverse of a Linked List. 48 | - Write a program in C/C++ to sort an Array in O(n). 49 | - WAP to reverse a linked list. 50 | - Implement queue. 51 | - What are the advantages of a doubly linked list? 52 | - Various types of Hashing-Linear, Quadratic and Mid-Square. 53 | - Decimal to Binary program using recursion. 54 | - Find the largest Number of Array using recursion. 55 | - WAP to sort a Linked List. 56 | - Program for converting Little to Big Endian. 57 | - Find the centre element of a linked list? 58 | - Print left the view of Binary Search Tree. 59 | - Implement a circular linked list. 60 | - Write a program on palindrome linked list and stack implementation using a linked list. 61 | - Program to remove duplicates from the linked list. 62 | - Program to detect if there is any loop in the linked list. 63 | - Write a program for a maximum of 4 numbers in good readable, optimized code. 64 | 65 |

66 | DBMS 67 | 68 | - Database design using Normalization. 69 | - What are DBMS, RDBMS and ORDBMS? 70 | - What is DDL, DML and DCL? 71 | - What has clustered indexing? 72 | - Transaction and normalisation. 73 | 74 |
75 |
76 | Operating System 77 | 78 | - Define Semaphores, Fragmentation, Normalization? 79 | - Discuss Deadlock, Cyclic wait. 80 | - Paging and segmentation. 81 | - What is thrashing? 82 | - What is the difference between a mutex and binary semaphore? 83 | - Can you name some IPC(Inter-process communication) mechanism? 84 | 85 |
86 |
87 | Miscellaneous 88 | 89 | - How to implement a class in C? 90 | - Difference between C and C++. 91 | - What is a template? 92 | - Elaborate upon the fact of inheritance in C structures. 93 | - How can you make the same variable accessible to two C programs? 94 | - Define Synchronization, Desynchronization, Interim, Manipulation(Java). 95 | - Name the technologies to store Sequential Files. 96 | - Difference between exe and dll. 97 | - Discussion about Volatile(in C). 98 | - Difference between const, const pointer, const to pointer(in C). 99 | - What is a virtual function in C++? What is a pure virtual function? 100 | - What is dual-core, cache m/m, the throughput of processors? 101 | - Abstract class and Interface in Java. 102 | - What is the difference between virtual and static class? 103 | - Differentiate between Call by value, call by address, call by reference. 104 | - Implement operator overloading in C++? 105 | 106 | 107 | ## Feel free to show your love :heart: by putting a star :star: on this project :v: . 108 | -------------------------------------------------------------------------------- /Netflix/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Netflix Interview Questions 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [System Design](#design) 9 | 10 | 11 | Coding round questions
12 | - Write a contains() function in JavaScript 13 | - Enhance the contains function to make it part of the JavaScript system(e.g. HTMLElement.prototype) 14 | - How do you find the union and intersection of two lists assuming millions of values? 15 | - How do you optimize the solution? 16 | - Write code to implement a singleton. 17 | 18 | --- 19 | Technical Interview Questions 20 | - What is a singleton? 21 |
22 | Data Structures and Algorithms 23 | 24 | - There are 10000 servers and need to send a file of size 1MB to each server, starting from a laptop. There is only 1 MB of bandwidth between each server. What's the shortest time possible to send this file to all the servers? 25 |
26 | 27 | DBMS 28 | 29 |
30 | 31 | Operating System 32 | 33 |
34 | 35 | System Design 36 | 37 |
38 | -------------------------------------------------------------------------------- /Ola Cabs/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Ola Cabs Interview Questions 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [References](#ref) 7 | ____ 8 | Coding round questions
9 | - There are two kinds of bots A and B in a 1-D array. ‘A’ bot can only move left while ‘B’ can only move right. There are also empty spaces in between represented by ‘#’. But it’s also given that the bots cannot cross over each other. Given the initial state and another state, we should tell if the transformation is possible. 10 | 11 | Sample Input- 12 | 2 13 | 14 | `#B#A# ##BA#` 15 | `#B#A# #A#B#` 16 | 17 | Sample output- 18 | Yes 19 | No 20 |

21 | - This was a simple one. Find the longest subarray in an array where the first element of the subarray is greater than the last element. The entire array shouldnt be taken as a subarray. 22 | 23 | Sample Input- 24 | 25 | 1 26 | 27 | 5 4 3 2 1 28 | 29 | Sample output – 30 | 31 | 5 4 3 2 32 | 33 | ---- 34 | Technical Interview Questions 35 |
36 | Data Structures and Algorithms 37 | 38 | # Ola Cabs Interview Questions 39 | * [Coding Round Questions](#coding) 40 | * [Technical Interview Questions](#tech) 41 | * [Data Structures and Algorithms](#dsalg) 42 | * [References](#ref) 43 | ____ 44 | Coding round questions
45 | - There are two kinds of bots A and B in a 1-D array. ‘A’ bot can only move left while ‘B’ can only move right. There are also empty spaces in between represented by ‘#’. But it’s also given that the bots cannot cross over each other. Given the initial state and another state, we should tell if the transformation is possible. 46 | 47 | Sample Input- 48 | 2 49 | 50 | `#B#A# ##BA#` 51 | `#B#A# #A#B#` 52 | 53 | Sample output- 54 | Yes 55 | No 56 |

57 | - This was a simple one. Find the longest subarray in an array where the first element of the subarray is greater than the last element. The entire array shouldn't be taken as a subarray. 58 | 59 | Sample Input- 60 | 61 | 1 62 | 63 | 5 4 3 2 1 64 | 65 | Sample output – 66 | 67 | 5 4 3 2 68 | 69 | ---- 70 | Technical Interview Questions 71 |
72 | Data Structures and Algorithms 73 | 74 | - Given a string, how many minimum rotations are needed to get back the same string. At least one rotation needs to be done 75 | 76 | Sample Input- 77 | 78 | 2 79 | 80 | abc 81 | 82 | abab 83 | 84 | Sample Output- 85 | 86 | 3 87 | 88 | 2 89 | 90 |

91 | - Find the distance between two nodes in a binary tree. 92 | 93 |
94 |
95 | Reference 96 | https://www.geeksforgeeks.org/ola-interview-experience-set-15-1-year-experienced-for-sde1/ 97 | 98 | 99 | - Given a string, how many minimum rotations are needed to get back the same string. Atleast one rotation needs to be done 100 | 101 | Sample Input- 102 | 103 | 2 104 | 105 | abc 106 | 107 | abab 108 | 109 | Sample Output- 110 | 111 | 3 112 | 113 | 2 114 | 115 |

116 | - Find the distance between two nodes in a binary tree. 117 | 118 |
119 |
120 | Reference 121 | https://www.geeksforgeeks.org/ola-interview-experience-set-15-1-year-experienced-for-sde1/ 122 | 123 | 124 | Coding round questions
125 | - Implement simple queue library which support concurrent operation. The queue has to support these data type -> Integer, Long, Double, String. The queue has to support these operations-> push, pop, peek. 126 | - Implement a simple map library with supports concurrent operations. Map has to support Integer or string keys. Map value has to support these data type-> Integer, Long, Double, String. The map has to support these operations-> put, get, delete, exist. 127 | - Implement a simple in memory Filesystem library that support the following functionality-> create directory, create file, delete file, delete directory, list directory. -------------------------------------------------------------------------------- /Palantir/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /PayPal/README.md: -------------------------------------------------------------------------------- 1 | # PayPal Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [DBMS](#dbms) 6 | * [Operating System](#os) 7 | * [Miscellaneous](#misc) 8 | * [References](#ref) 9 | ____ 10 | Coding round questions
11 | - An array A consists of n cells, n ranges from 0 to n. Each cell consists of n elements whose value ranges from 1 to n. Create an array B such that B[i] must be as small as B[j] for all values of j that appears in A. 12 | 13 | - Find the least number of coins required that can make any desired amount. The coins can only be pennies(1), nickels(5), dimes(10) and quarters(25). 14 | - Given an integer array of size n, find the maximum of the minimum’s of every window size in the array. Note that window size varies from 1 to n. 15 | 16 | ---- 17 | Technical Interview Questions 18 |
19 | Data Structures and Algorithms 20 | - Implement a singleton class. 21 | - Explain binary tree and binary search tree. 22 | - Implement stack using classes in C++. 23 | - Longest palindromic subsequence in string. 24 | - Detect loop in a linked list and remove it. 25 | - Select first 3 lines of the file. Select the longest line and count the number of words in that line. 26 | - Given an array of strings, find the shortest length palindrome. 27 | - Find the shortest cost path in a 3x3 matrix starting from top-left to bottom-right cell. 28 | - Design a sudoku solver. 29 |
30 | 31 | DBMS 32 | - Different types of joins. 33 | 34 | Operating System 35 | - Explain deadlock. 36 |
37 | 38 | Miscellaneous 39 | - What is dangling pointer? 40 | - What happens when you type a URL in web browser? 41 | - What are virtual functions and virtual destructors ? 42 | - Diamond structure problem. 43 | - What happens when you create an object using a base class pointer? 44 | - Why Java uses interface ? 45 | - Difference between array and ArrayList. Advantage of array. 46 | - Differnce between preincrement and postincrement. 47 | - Distinguish between Hashtable and HashMap. 48 | - How is HashMap implemented in Java? 49 | - Draw an entity relationship diagram for a student enrolment system. 50 | - Draw an entity relationship diagram for a airport management system. 51 | - Does encapsulation really exist in OOPS or is it just conceptual? 52 | -------------------------------------------------------------------------------- /Postmates/README.md: -------------------------------------------------------------------------------- 1 | Postmates Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithm](#dsalg) 5 | * [Miscellaneous](#misc) 6 | * [References](#ref) 7 | ____ 8 | Coding round questions
9 | - First non repeating character in a string 10 | - Check whether a string is 'beautiful'. A beautiful string is a string where the next lexographical character has less occurances than the previous character 11 | - Check if a 9x9 Sudoku board is valid 12 | - Given a square matrix of size NxN, complete the latin square. A Latin square is a square that contains N sets of numbers from 1 to N arranged tthat no such row or column contains the same number twice. 13 | 14 | Technical Interview Questions
15 | 16 | Data Structures and Algorithms 17 | 18 | DBMS 19 | 20 | Operating System 21 | 22 | System Design 23 | - Design FB messenger style chat system with support for group chats 24 | 25 | Miscellaneous 26 | 27 | References
28 | - LeetCode Discuss 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![All Contributors](https://img.shields.io/badge/all_contributors-49-orange.svg?style=flat-square)](#contributors) 3 | ![](https://github.com/rishabh115/Interview-Questions/blob/master/thumbnail.png) 4 | 5 | # Companies* 6 | 7 | | | Companies| 8 | | ------ | ------ | 9 | | **E** | [Expedia](Expedia/README.md) | 10 | | **G** | [Grab](Grab/README.md) | 11 | | **M** | [MobiKwik](MobiKwik/README.md) | 12 | | **N** | [NEC Technologies](NEC%20Technologies/README.md) | 13 | | **P** | [PayPal](PayPal/README.md) | 14 | | **S** | [Samsung Research Institute](Samsung/README.md) | 15 | | **U** | [Uber](Uber/README.md) | 16 | | **Y** | [Yatra.com](Yatra.com/README.md) | 17 | | **Z** | [Zomato](Zomato/README.md) | 18 | 19 | ## Announcements👐 20 | 📣This repo is not participating in hacktoberfest this year. 21 | There are many unfinished articles in this repo. Feel free to contribute or create the issue. 22 | 23 | #### Note: 24 | This repo is for educational purposes only. If you are going to contribute, don't do symbolic contribution. 25 | Strictly adhere to contributing guidelines and hacktoberfest rules. Fixing grammar, typos and formatting only 26 | is complete non-sense. And non-sense is highly discouraged. 27 | 28 | ## Top Contributors ✨ 29 | 30 | Thanks goes to these wonderful people: 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
Subash Selvaraj
Subash Selvaraj

💻
Shruti Bhutaiya
Shruti Bhutaiya

💻
Akshit Kharbanda
Akshit Kharbanda

💻
Dhruv Aggarwal
Dhruv Aggarwal

💻
Cheshta Kwatra
Cheshta Kwatra

💻
Kartikay Shandil
Kartikay Shandil

💻
Tanay Toshniwal
Tanay Toshniwal

💻
43 | 44 | 45 | #### For contributing see Contributing guidelines . 46 | 47 | ## Similar projects: 48 | - [Interviewee-Questions](https://github.com/alexakasanjeev/Interviewee-Questions) by [Sanjeev](https://github.com/alexakasanjeev) 49 | 50 | ## Feel free to show your love :heart: by putting a star :star: on this project :v: . 51 | References 52 | - [Geeksforgeeks](http://www.geeksforgeeks.org/) 53 | - [Career Cup](https://www.careercup.com/) 54 | - [Glassdoor](https://www.glassdoor.co.in/index.htm) 55 | 56 | 57 | -------------------------------------------------------------------------------- /RedHat/README.md: -------------------------------------------------------------------------------- 1 | # Red Hat Interview Questions 2 | 3 | - [Online Round Questions](#online) 4 | - [Technical Interview Questions](#tech) 5 | - [Data Structures and Algorithms](#dsalg) 6 | 7 | --- 8 | 9 | Online Round Questions
10 | 11 | - 2 questions from a flowchart. 12 | - There was a SQL query. 13 | - Some aptitude questions. 14 | - Some questions from CS fundamentals. 15 | - Some were specific to Java, Python, and C++. 16 | - Given a string of parenthesis like {()[{]).Check if it balanced or not. 17 |
18 | 19 | Technical Interview Questions 20 |
21 | Data Structures and Algorithms 22 | 23 | - Given a sentence and asked to reverse each word from it. 24 | - A simple BFS implementation question. 25 | - Discussion on projects. 26 | - Discussion on OS and Object-Oriented concepts. 27 | 28 |
29 | -------------------------------------------------------------------------------- /Roblox/README.md: -------------------------------------------------------------------------------- 1 | # Roblox Interview Questions 2 | * [Coding Round Questions](#coding) 3 | ____ 4 | Coding round questions
5 | - A warehouse manager needs to create a shipment to fill a truck.All the products in the warehouse are in boxes of same size.Each product is packed in some number of units per box.Given the number of boxes the truck can hold determine the maximum number of units of any mix of products that can be shipped 6 | 7 | Sample input- 8 | 9 | boxes=[1, 2, 3] 10 | unitsPerBox=[3, 2, 1] 11 | truckSize = 3 12 | 13 | Sample output- 14 | 7 15 | 16 | Explanation- 17 | 18 | The maximum number of units that can be shipped is 3 + 2 + 2 = 7 19 | 20 | ---- -------------------------------------------------------------------------------- /SAP Labs/README.md: -------------------------------------------------------------------------------- 1 | # SAP Labs Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [First Technical Interview (Code Pair)](#tech) 4 | * [Second Technical Interview (Telephonic)](#techtwo) 5 | ____ 6 | Coding round questions
7 | 8 | - Given an array of strings dates[], the task is to sort these dates in ascending order.Each date is of the form dd/mm/yyyy. 9 | - Sort an array of 0s, 1s and 2s 10 | - Check if a number is Bleak 11 | - Construct BST from Postorder 12 | - Given a string, remove spaces from it.
13 | Input: 14 | S = "geeks for geeks" 15 | Output: geeksforgeeks 16 | Explanation: All the spaces have been 17 | removed. 18 | - 19 | - Print pair of numbers from given array having minimum absolute value. 20 |
21 |
22 | First Technical Interview 23 |
24 | 25 | - Implement the fastest Sorting technique. 26 | - What is a class and object in C++. Explain by taking an example. 27 | - What is static and use of it? Give a real life example where you would use it? 28 | - What is use of inheritance? 29 | - What is difference between authorization and authentication? 30 | - Given a sentence find the word which has maximum length and is even.
31 | eg: String s= I like to eat banana
32 | output: banana 33 |
34 |
35 | Second Technical Interview 36 |
37 | 38 | DBMS 39 | 40 | - Types Of Keys 41 | - Indexes and types of Indexes 42 | - What is view and where it is stored 43 | 44 | OS 45 | 46 | - What is deadlock 47 | - How to prevent deadlock explain Bankers Algorithem 48 | - Disk Scheduling Algorithem 49 | 50 | DSA 51 | - Given a stream of data perform addition of the data. 52 | 53 | 54 | -------------------------------------------------------------------------------- /Samsung/README.md: -------------------------------------------------------------------------------- 1 | # Samsung Research Institute Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [DBMS](#dbms) 6 | * [Operating System](#os) 7 | * [Miscellaneous](#misc) 8 | * [References](#ref) 9 | ____ 10 | Coding round questions
11 | #### Popular Tags 12 | dynamic-programming 13 | Graph 14 | backtracking 15 | DFS 16 | BFS 17 | Bipartite-Graph 18 | - Company S has developed an industrial endoscope available to explore inner part of the decrepit water pipes. 19 | It is possible to explore the inner part of the pipes putting the endoscope in a certain part of the pipe. 20 | The endoscope can be moved in the pipe only. Meanwhile, when the pipes are connected, if the length of the endoscope is long enough to explore, then it can inspect the connected pipes. However, we cannot observe every pipe because the length of the endoscope is limited. 21 | 22 | When the map of the ground water pipe, the location where the endoscope to out in, and the length of the endoscope is given, calculate the number of pipe which are available to explore. Length of endoscope means the range upto which endoscope can explore. There are seven kind of pipes, and description for each pipe are shown below: 23 | 24 | 25 | | S.No | Pipe | Connected to | 26 | | -----|:-------------: | -------------:| 27 | | 1 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/1.png ) | Up, Down, Left, Right | 28 | | 2 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/2.png ) | Up, Down | 29 | | 3 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/3.png ) | Left, Right | 30 | | 4 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/4.png ) | Up, Right | 31 | | 5 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/5.png ) | Down, Right | 32 | | 6 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/6.png ) | Down, Left | 33 | | 7 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/7.png ) | Up, Left | 34 | 35 | When the map of the groundwater pipe, the location where the endoscope to out in, and the length of the endoscope is given, calculate the number of the pipe which are available to explore. Length of endoscope means the range up to which endoscope can explore. 36 | #### Input 37 | In the first line, T, the number of total test cases are given. From the second line, T test cases are given. In the first line of each test case, N, the height of the map of the groundwater pipes, M, the width, R, the vertical location of the water pipe where to put in the endoscope, C, the horizontal location of it, and the length of the endoscope L are given. In the following N lines, information about the map of the groundwater pipe is given. Each line has M numbers. Each number (from 1 to 7) means the type of water pipe for that point. 0 means there is no water pipe buried in that place. 38 | 39 | #### Output 40 | Print the respective answer for T test cases in total for T lines. The answer is the number of water pipes which is available to observe using the endoscope. 41 | 42 | #### Constraints 43 | 1≤ T ≤100 44 | 45 | 1≤ N, M ≤50 46 | 47 | 0≤ X < N 48 | 49 | 0≤ Y < M 50 | 51 | 1≤ L ≤ 20 52 | 53 | - Men's restroom problem: It is a well-researched fact that men in a restroom generally prefer to maximize their distance from already occupied stalls, by occupying the middle of the longest sequence of unoccupied places. For a detailed version, check the following link.
54 | Link: https://stackoverflow.com/questions/32645046/urinal-algorithm-a-simple-optimization 55 | 56 | - Given a graph print either of the set of the vertices that are colored with the same color. And if the graph is not bipartite print “-1”. Test cases also included cases when a graph is not connected. 57 | 58 | - You’ll be given a grid as below: 59 | ``` 60 | 0 1 0 2 0 --> Non highlighted part 61 | 0 2 2 2 1 62 | 0 2 1 1 1 63 | 1 0 1 0 0 64 | 0 0 1 2 2 65 | 1 1 0 0 1 66 | x x S x x -->highlighted yellow 67 | ``` 68 | In the grid above, 69 | 1: This cell has a coin. 70 | 2: This cell has an enemy. 71 | 0: It contains nothing. 72 | The highlighted(yellow) zone is the control zone. S is a spaceship that we need to control so that we can get maximum coins. 73 | Now, S’s initial position will be at the center and we can only move it right or left by one cell or do not move. 74 | At each time, the non-highlighted part of the grid will move down by one unit. 75 | We can also use a bomb but only once. If we use that, all the enemies in the 5×5 region above the control zone will be killed. 76 | If we use a bomb at the very beginning, the grid will look like this: 77 | ``` 78 | 0 1 0 2 0 --> Non highlighted part 79 | 0 0 0 0 1 80 | 0 0 1 1 1 81 | 1 0 1 0 0 82 | 0 0 1 0 0 83 | 1 1 0 0 1 84 | x x S x x --> highlighted yellow 85 | ``` 86 | As soon as, the spaceship encounters an enemy or the entire grid has come down, the game ends. 87 | For example, 88 | At the very first instance, if we want to collect a coin we should move left **( coins=1)**. This is because when the grid comes down by 1 unit we have a coin on the second position and by moving left we can collect that coin. Next, we should move right to collect another coin **( coins=2)** . 89 | After this, remain at the same position **( coins=4)**. 90 | This is the current situation after collecting 4 coins. 91 | ``` 92 | 0 1 0 2 0 0 1 0 0 0 93 | 0 2 2 2 1 -->after using 0 0 0 0 1 94 | x x S x x -->bomb x x S x x 95 | ``` 96 | Now, we can use the bomb to get out of this situation. After this, we can collect at most 1 coin. So maximum coins=5. 97 | - A Research team want to establish a research center in a region where they found some rare-elements.They want to make it closest to all the rare-elements as close as possible so that they can reduce overall cost of research over there. It is given that all the rare elements location is connected by roads. It is also given that Research Center can only be built on the road. The team decided to assign this task to a coder.If you feel you have that much potential. 98 | Here is the Task:- Find the shortest of the longest distance of the research centre from given locations of rare-elements. 99 | locations are given in the matrix cell form where 1 represents roads and 0 no road... 100 | number of rare-element and their location was also given(number<=5) 101 | and order of square matrix was less than equal to (20). 102 | - Given a Binary Tree where each node has positive and negative values. Convert this to a tree where each node contains the sum of the left and right subtrees in the original tree. The values of leaf nodes are changed to 0. 103 | - Write a function that calculates the day of the week for any particular date in the past or future. A typical application is to calculate the day of the week on which someone was born or some other special event occurred. 104 | - Given a Binary Tree, write a function that returns the size of the largest subtree which is also a Binary Search Tree (BST). If the complete Binary Tree is BST, then return the size of the whole tree. 105 | - You are given an array of integers which represents positions available and an integer c(cows). 106 | Now you have to choose c positions such that the minimum difference between cows is maximized. 107 | ``` 108 | For example, 109 | 1 3 5 8 10 110 | c=3 111 | output: 4 112 | 1 5 10 113 | ``` 114 | - Given a Binary Tree and a node x in it, find the distance of the closest leaf to x in Binary Tree. If given node itself is a leaf, then the distance is 0. 115 | - Given random points in a 2-D plane, construct a convex polygon with a minimum area of coverage and which encompasses all the given points. 116 | - Given a graph, find out if it can be colored using 2 colors. If Yes, print numbers of vertices with any one of the colour, followed by such vertices in sorted order. If No just print -1 117 | - Given a 2 D matrix where 1 represents the places where the frog can jump and 0 represent the empty spaces, the frog can move freely in the horizontal direction (on 1’s only) without incurring any cost (jump). A vertical jump from a given point of the matrix to another point on the matrix can be taken (on 1’s only) with cost as the number of jumps taken. 118 | Given a source and destination, the frog has to reach the destination minimizing the cost (jump) 119 | - Given a directed graph. Check whether a graph contain a cycle or not. 120 | - Given a level K , you have to find out the sum of data of all the nodes at level K in a binary tree. 121 | Input is given as: 122 | ``` 123 | (P(C()())(C()())) 124 | P is for Parent, C is for child. 125 | if parent has one child : (P(C()())()) 126 | if parent has no child : (P()()) 127 | ``` 128 | - A company sells its products with a unique serial number on it. Company has has found that there are some products that don’t sell well which are identified to have ominous numbers in the serial number of the product. So if a serial number of the product contains atmost ’k’ ominous number then it won’t sell. 129 | Given a range form s to e, you need to find number of products that would sell, leaving out the products that contains atmost ’k’ ominous numbers. 130 | 131 | `` 132 | Input: First line contains the number of test cases, followed by the range s to e, 1 133 | `` 134 | - You are given N unique numbers a1 2 operations. (Each touch is considered an operation). 189 | If you have to type 5 -> '1+4=' that requires 4 operations. There could be other ways to make '5'. 190 | The goal is to find minimum operations. 191 | 192 | - There are N pots. Every pot has some water in it. They may be partially filled. Every pot is associated with overflow number O which tell how many minimum no. of stones required for that pot to overflow. The crow knows O1 to On(overflow no. for all the pots). Crow wants some K pots to be overflow. So the task is a minimum number of stones he can make K pots overflow in the worst case. 193 | 194 | Array of overflow no--. {1,...,On} 195 | Number of pots--n 196 | No of pots to overflow-- k 197 | 198 | Let say two pots are there with overflow no.s {5,58}, and the crow has to overflow one pot(k=1). So crow will put 5 stones in a pot with overflow no.(58), it will not overflow, then he will put in the pot with overflow no.(5), hence the total no. of stones to make overflow one-pot is=10. 199 | 200 | - You are given 2 convex hulls. Find all the common points that lie in the intersection of these 2 convex hulls. 201 | 202 | - There is one spaceship. X and Y co-ordinate of the source of spaceship and destination spaceship is given. There is N number of wormholes; each wormhole has 5 values. 203 | First 2 values are starting co-ordinate of the wormhole and after that value no. 3 and 4 represent ending co-ordinate of the wormhole and last 5th value is represents a cost to pass through this wormhole. Now, these warmholes are bi-directional. 204 | Now the to go from (x1,y1) to (x2,y2) is abs(x1-x2)+abs(y1-y2). 205 | The main problem here is to find the minimum distance to reach spaceship from source to destination co-ordinate using any number of warm-hole. It is ok if you won't uses any warmhole. 206 | - There is an island surrounded by oil mines. You will be given n companies and m oil mines having values. You have to distribute the mines to "n" companies in fair manner. Remember the companies can have oil mines adjacent to each other and not in between of each other.After distributing them compute the difference of oil mines from the company getting highest and company getting lowest. This number should be minimum.(then only the distribution can be termed as fair). 207 | 208 | 209 | Example 210 | Input 211 | 2 212 | 2 4 213 | 6 13 10 2 214 | 2 4 215 | 6 10 13 2 216 | 217 | output 218 | 5 219 | 1 220 | 221 | - There is a n x n matrix with only 0s & 1s. Letters are formed using 1 and 0. 222 | For eg.- 223 | 224 | 225 | 226 | U is 1 0 1, V is 1 0 1 227 | 1 0 1 1 0 1 228 | 1 1 1 0 1 0 229 | 230 | 231 | 232 | Likewise there are 6 letters and they can rotated in 90, 180, 270, 360 degree. And if there is a letter, the next column would be filled with 0. 233 | Eg. 234 | 235 | 236 | 237 | V- 1 0 1 0 238 | 1 0 1 0 239 | 0 1 0 0 240 | 241 | 242 | 243 | So we have to count the number of each letter in the matrix. 244 | 245 | - There is a maze that has one entrance and one exit. 246 | Jewels are placed in passages of the maze. 247 | You want to pick up the jewels after getting into the maze through the entrance and before getting out of it through the exit. 248 | You want to get as many jewels as possible, but you don’t want to take the same passage you used once. 249 | 250 | When locations of a maze and jewels are given, 251 | find out the greatest number of jewels you can get without taking the same passage twice, and the path taken in this case. 252 | 253 | ![](https://github.com/rishabh115/InterviewQuestions/blob/master/Samsung/res/jewel.jpg?raw=true) 254 | #### Input 255 | There can be more than one test case in the input file. The first line has T, the number of test cases. 256 | Then the totally T test cases are provided in the following lines (T ≤ 10 ). 257 | 258 | In each test case, 259 | In the first line, the size of the maze N (1 ≤ N ≤ 10) is given. The maze is N×N square-shaped. 260 | From the second line through N lines, information of the maze is given. 261 | “0” means a passage, “1” means a wall, and “2” means a location of a jewel. 262 | The entrance is located on the upper-most left passage and the exit is located on the lower-most right passage. 263 | There is no case where the path from the entrance to the exit doesn’t exist. 264 | 265 | #### Output 266 | From the first line through N lines, mark the path with 3 and output it. 267 | In N+1 line, output the greatest number of jewels that can be picked up. 268 | Each test case must be output separately as a empty. 269 | 270 | - Mr. Lee has to travel various offices abroad to assist branches of each place. But he has a problem. The airfare would be real high as all offices he has to visit are in foreign countries. He wants to visit every location only one time and return home with the lowest expense. 271 | Help this company-caring man calculate the lowest expense. 272 | 273 | Time limit : 1 second (java : 2 seconds) 274 | 275 | #### Input format 276 | 277 | Several test cases can be included in the inputs. T, the number of cases is given in the first row of the inputs. After that, the test cases as many as T (T ≤ 30) are given in a row. 278 | N, the number of offices to visit is given on the first row per each test case. At this moment, No. 1 office is regarded as his company (Departure point). (1 ≤ N ≤ 12) 279 | Airfares are given to move cities in which branches are located from the second row to N number rows. I.e. jth number of ith row is the airfare to move from ith city to jth city. If it is impossible to move between two cities, it is given as zero. 280 | 281 | #### Output format 282 | 283 | Output the minimum airfare used to depart from his company, visit all offices, and then return his company on the first row per each test case. 284 | 285 | Example of Input 286 | 287 | 2
288 | 5
289 | 0 14 4 10 20
290 | 14 0 7 8 7
291 | 4 5 0 7 16
292 | 11 7 9 0 2
293 | 18 7 17 4 0
294 | 5
295 | 9 9 2 9 5
296 | 6 3 5 1 5
297 | 1 8 3 3 3
298 | 6 0 9 6 8
299 | 6 6 9 4 8
300 | 301 | Example of Output 302 | 303 | 30
304 | 18 305 | 306 | - There is a mobile piece and a stationary piece on the N×M chessboard. The available moves of the mobile piece are the same as set out in the image below. You need to capture the stationary piece by moving the mobile piece with the minimum amount of moves. 307 | 308 | Write a program to find out the minimum number moves to catch a piece. 309 | 310 | Time limit:1 second (java: 2 seconds) 311 | 312 | #### Input 313 | Several test cases can be included in the inputs. T, the number of cases is given in the first row of the inputs. After that, the test cases as many as T (T ≤ 20) are given in a row. 314 | N, the numbers of the rows and M, the number of columns of the chessboard are given in the first row of each test case. 315 | R & C is the location information of the attacking piece and S & K is the location of the defending pieces and are given in the row at the second line. However, the location of the uppermost end of the left end is (1, 1) 316 | 317 | #### Output 318 | For each test case, you should print "Case #T" in the first line where T means the case number. 319 | For each test case, you should output the minimum number of movements to catch a defending piece at the first line of each test case. If not moveable, output equals ‘-1’. 320 | 321 | 322 | - You are busy to promote a newly released film in a movie theatre . the title is 'Biochemical Laughing Bomb' which is about terror. Guerillas drop a biochemical laughing bomb in the middle of a city. once exposed, you have to laugh all your life. The bomb will contaminate four people around it during t second, and another four around each of them during another one second. However, you won't be contaminated if you are not in the adjacent four directions. as the below shows the location of the bomb and affected people , and shows contamination process in seconds and you can figure out that the whole city is contaminated in 8 seconds. 323 | In order to protect the city from the epidemic, create a program that figures out when the city will be contaminated by the bomb for the last. 324 | 325 | #### Input 326 | Several test cases can be included in the inputs. T, the number of cases is given in the first row of the inputs. After that, the test cases as many as T (T ≤ 30) are given in a row. 327 | The row and column of the city, N and M are given by being separated with a blank on the first row of each test case. (1 ≤ N, M ≤ 100) 328 | The status within city is given by being separated with a blank from the second row to N number rows. 1 means people exist and 0 means people do not exist. 329 | The coordinate of the row and column on which the bomb fall is given by being separated with a blank on the last row. 330 | 331 | #### Output 332 | For each test case, you should print "Case #T" in the first line where T means the case number. For each test case, you should output how long does it take to contaminate al people on the first row of each test case. 333 | - Given number of pipes 1..n, Find two largest pipes of maximum length possible. 334 | Ex: input - 1,2,3,4,6 335 | Output - The maximum length possible is 8. 336 | Pipe1 - 2,6 337 | Pipe2 - 1,3,4 338 | 339 | - A Research team want to establish a research center in a region where they found some rare-elements. They want to make it closest to all the rare-elements as close as possible so that they can reduce overall cost of research over there. It is given that all the rare-element’s location is connected by roads. It is also given that Research Center can only be build on road. Team decided to assign this task to a coder. If you feel you have that much potential.. 340 | 341 | Here is the Task :- Find the shortest of the longest distance of research center from given locations of rare-elements. 342 | 343 | Locations are given in the matrix cell form where 1 represents roads and 0 no road.. 344 | Number of rare-element and their location was also given(number<=5) 345 | and order of square matrix was less than equal to (20). 346 | 347 | - There is a source (S) and destination (D) and a spacecraft has to go from S to D. There are N number of wormholes in between 348 | which has following properties: 349 | 350 | Each wormhole has an entry and an exit. 351 | Each wormhole is bi-directional i.e. one can enter and exit from any of the ends. 352 | The time to cross the wormhole is given and the space craft may or may not use the wormhole 353 | to reach D. 354 | The time taken to travel outside wormhole between two points (x1, y1) and (x2, y2) is given by a formula 355 | |x1 - x2| + |y1 - y2| 356 | 357 | where, (x1, y1) and (x2, y2) are the co-ordinates of two points. 358 | The co-ordinates of S and D are given and we have to find the minimum time to reach D from S. 359 | 360 | Note: It’s not mandatory to consider all the wormholes. 361 | 362 | - There are n balloons and n bullets and each balloon is assigned with a particular number (point). Whenever a particular balloon is shot the no of points increases by 363 | 1.the multiplication of point assigned to balloon on left and that of right side. 364 | 365 | 2.point assigned to left if no right exists 366 | 367 | 3.point assigned to right if no left exists. 368 | 369 | 4.the point assigned to itself if no other balloon exists. 370 | 371 | You have to output the maximum no of points possible. 372 | 373 | Input 374 | 375 | 1 2 3 4 376 | 377 | Output 378 | 379 | 20 380 | 381 | ---- 382 | Technical Interview Questions 383 |
384 | Data Structures and Algorithms 385 | - Write the code of heap sort and complexity in different cases. 386 | - Implement Kadane's Algorithm. 387 | - Kahn's algorithm for topological sorting. 388 | - Which DS is used to manage files and folder in your mobile? 389 | - Write code for Dijkstra Algorithm. 390 | - Find the kth minimum element into binary search. 391 | - What is memory leak? How to avoid it? 392 | - Write a program to create circular queue? 393 | - Detect and remove loop in linked list. 394 | - Design LRU data structure. 395 | - WAP for finding nth node from the end in the linked list. 396 | - Explain KMP Algorithm. 397 | - Zigzag traversal between two singly linked list. 398 | - There is a N*M matrix where each row is sorted. Find the kth largest element in matrix? 399 | - Print sum of all prime numbers within a given range. 400 | - Find the largest and second largest element in array. Give 4 different approaches. 401 | - Given two polynomials as linked lists, return a linked list which represents the product of two polynomials. 402 | - What is the difference between dynamic programming and divide and conquer? 403 | - Given two polynomials represented by two arrays, write a function that multiplies given two polynomials. 404 | - What are the disadvantages of stack. 405 | - Write a program to find when we get stack overflow if we are using recursive functions. 406 | - How cycle detection is different in directed and undirected graphs? 407 | - Write a program to append a C-style string to the end of another C-style string. You were supposed to 408 | write a function like void concat(char* a , char* b) such that after calling this function a becomes 409 | a+b(concatenation of a and b). Assume that size of a is greater than length of a+length of b.No 410 | library functions were to be used. Not even strlen. 411 | - Why do we need trie data structure?Tell one another technique which does the same job as trie 412 | with same time complexity? Then why trie is preferred over that one?(The other technique which I 413 | told was hashing). 414 | - Given a binary tree remove nodes to make it 'Perfect'. Print all removed nodes. 415 |

416 | DBMS 417 | 418 | - What is view in DBMS? 419 | - What is Indexing? 420 | - You have a student table having 3 attributes student_name, subject and marks. Find the subject-wise maximum mark of students. Arrange the subjects in ascending order and marks in descending order 421 | - Primary indexing vs Secondary indexing vs cluster indexing, multilevel indexing. 422 | - Sparse indexing vs dense indexing. 423 | - Lossless decomposition vs Lossy decomposition. 424 | - Describe join operation w.r.t databases. 425 |
426 |
427 | Operating System 428 | 429 | - What is page fault and why it occurs? 430 | - What is virtual memory? 431 | - What is Demand Paging? 432 | - Explain Semaphore. 433 | - While context switching takes place what is stored on stack and heap. 434 | - Write code for Producer-Consumer Problem. 435 | - What is Swap In and Swap Out? 436 | - Differentiate between Starvation and Aging. 437 | - Explain the page replacement Algorithm LRU. 438 | - What is Inter process communication ,types and which one is fast and why? 439 | - What is fragmentation? Define external fragmentation. 440 | - Calculate the number of processes generated using N fork() statements? 441 | - Due to priority of process, what type of problem occurs in priority scheduling? 442 | - What is real time OS. 443 | - Difference between preemptive and non- preemptive algorithms. 444 | - If time slice is greater than the execution time of largest execution time process than round robin acts as...? 445 | - There is a file and 5 processes. How can you grant access so that 446 | only 2 process can write to file and 1 can read file at a time . 447 | - Stack pointer vs Frame pointer. 448 | - Explain spooling. 449 | - You are given a process A. The scheduler is using Priority Based Round Robin Technique for 450 | scheduling various process. Suppose at some instant A was being run and it entered its critical 451 | section. And there it acquired a resource X. Meanwhile another process B comes to the ready 452 | queue. B has more priority than A. Now the preemption occurs and scheduler decides to run B and it 453 | also wants t own resource X to complete some task. Now B won’t be able to take the resource as A 454 | is already having it but since it has higher priority it must run before A. So is this condition a 455 | deadlock? Explain with reasons. 456 | - What is starvation? Out of priority based round robin scheduling and priority based scheduling , which one is more likely 457 | to suffer from the problem of starvation? How to recover from starvation? 458 | - Static and dynamic memory allocation and followup questions on stack and heap. 459 |
460 | Miscellaneous 461 | 462 | - Explain and give an example of a function pointer. Write function pointer for a function that takes an integer as a parameter and returns character. 463 | - Implement you own strcat() function. Dont use string header. 464 | - Difference between TCP and UDP. 465 | - What is Inline functions? 466 | - Make a utility function in C to detect memory leaks in any program given its source code,you are allowed to modify input program minimally for this purpose. 467 | - Balloon burst problem. 468 | - Write a program to allocate a 3D-array dynamically. 469 | - Write your own typedef operator. 470 | - What is meant by Early binding and late binding. 471 | - State various protocols in various layers of TCP/IP. 472 | - Create a pointer that can point to an array of integers. 473 | - Explain client server architecture. 474 | - What is L-value and R-value reference? 475 | - State various principles of OOPS. 476 | - Define MFC COM and DCOM. 477 | - Difference between NULL and NIL. 478 | - What is meant by Big and Small Endian? How would you know that Machine code is Big or Small Endian? 479 | - What is friend class and function in C++? 480 | - What is Virtual Function in C++? 481 | - Explain VTABLE and VPTR? 482 | - Difference between sizeOf(void) and sizeOf(void*). 483 | - Full form of conio. 484 | - Describe Java's garbage collection. 485 | - Explain Abstract and pure Virtual function in detail. 486 | - What is the difference between a static and const variable? 487 | - Do namespaces interact? if yes, how? if no, why not? 488 | - Define Scheduling. Which data structure is used in scheduling? 489 | - Where are the local, global, static, auto, register, extern, const, volatile variables stored? 490 | - What is a virtual destructor? Explain the use of it - C++. 491 | - What is a void pointer, a smart pointer, a wild pointer, a null pointer, and a dangling pointer? In what cases are they used? 492 | - What is the difference between a deep copy and a shallow copy? 493 | - Explain Diamond problem in C++. 494 | - What is segmentation fault? 495 | - Implement 3 stacks using 1 array. 496 | - Explain MultiLevel inheritance. 497 | - Memory layout of C program. 498 | - What is structure padding ? 499 | - What are memset and memcopy? 500 | - What is function pointer? 501 | - There are some exceptions that cannot be caught by try catch. How to catch such exceptions? Can we prevent our program to crash if we are not able to catch such exceptions. 502 | - What is name mangling, and how does it work? 503 | - What does malloc(0) return? 504 | - There are 25 horses and 1 racing track. You can conduct a race of atmost 5 horses on that track. You 505 | need to find fastest 3 horses. What is the minimum number of races do you require? 506 | - You are given 8 batteries and 1 torch. 4 batteries are working and 4 are dead. The torch 507 | accommodates 2 batteries. If both the batteries are working then the torch will glow otherwise not. 508 | What is the minimum number of times you need to switch the torch to find out 2 working batteries? 509 | - How to prevent multiple object instantiations of a class ? 510 | - Explain the math behind gradient descent ? 511 | 512 | ## Feel free to show your love :heart: by putting a star :star: on this project :v: . 513 | -------------------------------------------------------------------------------- /Samsung/res/.nofile: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Samsung/res/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/Samsung/res/1.png -------------------------------------------------------------------------------- /Samsung/res/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/Samsung/res/2.png -------------------------------------------------------------------------------- /Samsung/res/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/Samsung/res/3.png -------------------------------------------------------------------------------- /Samsung/res/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/Samsung/res/4.png -------------------------------------------------------------------------------- /Samsung/res/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/Samsung/res/5.png -------------------------------------------------------------------------------- /Samsung/res/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/Samsung/res/6.png -------------------------------------------------------------------------------- /Samsung/res/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/Samsung/res/7.png -------------------------------------------------------------------------------- /Samsung/res/jewel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/Samsung/res/jewel.jpg -------------------------------------------------------------------------------- /Samsung/solution/cr1.markdown: -------------------------------------------------------------------------------- 1 | ```Java 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.util.*; 6 | 7 | class TestClass { 8 | static int map[][], ans=0,n,m,r,c,l; 9 | static boolean compat(int x,int y,int i,int j) 10 | {if(x==i&&y==j)return true; 11 | //System.out.println(ans+" "+x+" "+y+" "+i+" "+j+" "); 12 | if(map[x][y]==1) 13 | { 14 | if((i==x-1&&j==y)||(i==x&&j==y-1)||(i==x+1&&j==y)||(i==x&&j==y+1))return true; 15 | else return false; 16 | } 17 | else if(map[x][y]==2) 18 | { 19 | if((i==x+1&&j==y)||(i==x-1&&j==y))return true; 20 | return false; 21 | 22 | } 23 | else if(map[x][y]==3) 24 | { 25 | if((i==x&&j==y-1)||(i==x&&j==y+1))return true; 26 | return false; 27 | 28 | } 29 | else if(map[x][y]==4) 30 | { 31 | if((i==x-1&&j==y)||(i==x&&j==y+1))return true; 32 | return false; 33 | 34 | } 35 | else if(map[x][y]==5) 36 | { 37 | if((i==x+1&&j==y)||(i==x&&j==y+1))return true; 38 | return false; 39 | 40 | } 41 | else if(map[x][y]==6) 42 | { 43 | if((i==x+1&&j==y)||(i==x&&j==y-1))return true; 44 | return false; 45 | 46 | } 47 | else if(map[x][y]==7) 48 | { 49 | if((i==x&&j==y-1)||(i==x-1&&j==y))return true; 50 | return false; 51 | 52 | } 53 | 54 | 55 | 56 | 57 | return false; 58 | 59 | 60 | } 61 | static boolean cmap[][]; 62 | public static void main(String args[] ) throws Exception { 63 | Scanner s = new Scanner(System.in); 64 | int t=s.nextInt(); 65 | while((--t)>=0) 66 | {n = s.nextInt(); 67 | m =s.nextInt(); 68 | r =s.nextInt(); 69 | c =s.nextInt(); 70 | l =s.nextInt(); 71 | 72 | 73 | map=new int[n][m]; 74 | cmap=new boolean[n][m]; 75 | for (int i = 0; i =n||j<0||j>=m)return ; 86 | if(map[i][j]==0)return ; 87 | 88 | if(!compat(i,j,px,py))return ; 89 | if(cmap[i][j]){} 90 | else ans++; 91 | cmap[i][j]=true; 92 | 93 | if(map[i][j]==1) 94 | {solve(i-1,j,i,j,len-1); 95 | solve(i,j-1,i,j,len-1); 96 | solve(i+1,j,i,j,len-1); 97 | solve(i,j+1,i,j,len-1); 98 | } 99 | else if(map[i][j]==2) 100 | {solve(i-1,j,i,j,len-1); 101 | solve(i+1,j,i,j,len-1); 102 | } 103 | else if(map[i][j]==3) 104 | {solve(i,j+1,i,j,len-1); 105 | solve(i,j-1,i,j,len-1); 106 | } 107 | else if(map[i][j]==4) 108 | { 109 | 110 | solve(i,j+1,i,j,len-1); 111 | solve(i-1,j,i,j,len-1); 112 | } 113 | else if(map[i][j]==5) 114 | { 115 | 116 | solve(i,j+1,i,j,len-1); 117 | solve(i+1,j,i,j,len-1); 118 | } 119 | else if(map[i][j]==6) 120 | { 121 | 122 | solve(i,j-1,i,j,len-1); 123 | solve(i+1,j,i,j,len-1); 124 | } 125 | else if(map[i][j]==7) 126 | { 127 | 128 | solve(i,j-1,i,j,len-1); 129 | solve(i-1,j,i,j,len-1); 130 | } 131 | } 132 | 133 | 134 | } 135 | ``` 136 | -------------------------------------------------------------------------------- /Snowflake/README.md: -------------------------------------------------------------------------------- 1 | # Snowflake Interview Questions 2 | 3 | Coding round questions
4 | - [Two sum problem with slight variation](https://leetcode.com/problems/two-sum/) 5 | - [Maximum product of two non overlapping palindromic sub-sequences](https://stackoverflow.com/questions/53663721/find-the-maximum-product-of-two-non-overlapping-palindromic-subsequences#:~:text=Find%20the%20maximum%20product%20of%20two%20non%20overlapping%20palindromic%20subsequences,-java%20algorithm%20data&text=For%20input%20string%20%22acdapmpomp%22%2C,score%203%20*%205%20%3D%2015.) 6 | - [Maximum size of square such that all submatrices of that size have sum less than K](https://www.geeksforgeeks.org/maximum-size-of-square-such-that-all-submatrices-of-that-size-have-sum-less-than-k/) -------------------------------------------------------------------------------- /Thoughtworks/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Twitter/README.md: -------------------------------------------------------------------------------- 1 | # Twitter Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [DBMS](#dbms) 6 | * [Operating System](#os) 7 | * [System Design](#design) 8 | * [Miscellaneous](#misc) 9 | * [References](#ref) 10 | 11 | Coding round questions
12 | - Given a tuple for eg.(a,b,c) Output: (*, *, *), (*, *, c), (*, b, *), (*, b, c), (a, *, *), (a, *, c), (a, b, *), (a, b, c) 13 | - Convert infix expression into postfix 14 | - Write code that walks through all source code starting from a root directory and create a histogram of the number of characters per line across all files. 15 | - "Critique" a snippet of code pasted on collabedit. 16 | - Given an array with all elements sorted on each individual row and column find the K-th smallest one. 17 | - Implement a hast table. 18 | 19 | Technical Interview Questions 20 |
21 | Data Structures and Algorithms 22 | 23 |

24 | DBMS 25 | 26 | 27 | 28 |
29 |
30 | Operating System 31 | 32 |
33 |
34 | System Design 35 | 36 |
37 |
38 | Miscellaneous -------------------------------------------------------------------------------- /Uber/README.md: -------------------------------------------------------------------------------- 1 | # Uber Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [DBMS](#dbms) 6 | * [Operating System](#os) 7 | * [Miscellaneous](#misc) 8 | * [References](#ref) 9 | ____ 10 | Coding round questions
11 | 12 | - Given a sorted array arr[] and a number x, write a function that counts the occurrences of x in arr[]. (O(Log(N))) 13 | - A text file contains {candidateID,voterID} details of an ongoing voting. 14 | Read this file in real time and report top 5 candidates. 15 | Also report a fraud if a Voter tries to vote twice or try to vote more then one candidate. 16 | Assume that the database is offline. 17 | - Write a program to check whether Sudoku is valid or not. 18 | - Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. 19 | - Given an array of words, print the count of all anagrams together in sorted order (increasing order of counts). 20 | For example, if the given array is {“cat”, “dog”, “tac”, “god”, “act”}, then grouped anagrams are “(dog, god) (cat, tac, act)”. So the output will be 2 3. 21 | - Given a roman numeral, convert it to an integer. 22 | - Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. 23 | The same repeated number may be chosen from C unlimited number of times. 24 | - Given a digit string, return all possible letter combinations that the number could represent in a T9 keypad. 25 | ``` 26 | Input:Digit string "23" 27 | Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. 28 | ``` 29 | - Given two list of unsorted intervals V1 and V2 write 2 functions 'OR ' and 'AND' to return a new list 30 | 31 | OR Function (union of list ): Input V1 = (2,4) (6,8) (1,3) V2 = (7,9) (2,5) 32 | Output = (1,5) (6,9) 33 | 34 | AND function : This will be intersection function and will return intersection of the lists. 35 | - Given an unsorted array of integers, find the length of the longest consecutive elements sequence. 36 | Your algorithm should run in O(n) complexity. 37 | - Generate all possible matched parenthesis, given n left parenthesis and right parenthesis needs to be matched. 38 | - There is a notepad which accepts only four operations: 39 | 1. Character X 40 | 2. select all 41 | 3. copy 42 | 4. paste 43 | 44 | Given n number of operations, provide the sequence of choices that gives maximum characters in the notepad. 45 | - Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. 46 | - Given a list of system packages, some packages cannot be installed until the other packages are installed. Provide a valid sequence to install all of the packages. 47 | 48 | e.g. 49 | a relies on b 50 | 51 | b relies on c 52 | 53 | then a valid sequence is [c, b, a]. 54 | - Given a string s, partition s such that every substring of the partition is a palindrome. 55 | Return all possible palindrome partitioning of s. 56 | - Given a string s, return all the palindromic permutations ( without duplicates), of it. Return an empty array if no palindromic combinations can be formed. 57 | - Given an input string and ordering string, need to return true if the ordering string is present in Input string. 58 | - Given a sorted dictionary (array of words) of an alien language, find order of characters in the language. 59 | - Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. 60 | - Given an api which returns an array of chemical names and an array of chemical symbols, display the chemical names with their symbol surrounded by square brackets: 61 | 62 | ``` 63 | Ex: 64 | Chemicals array: ['Amazon', 'Microsoft', 'Google'] 65 | Symbols: ['I', 'Am', 'cro', 'Na', 'le', 'abc'] 66 | 67 | Output: 68 | [Am]azon, Mi[cro]soft, Goog[le] 69 | 70 | ``` 71 | - WAP to take one element from each of the array add it to the target sum. Print all those three-element combinations. 72 | 73 | - Given two numbers represented by two linked lists, write a function that returns sum list. 74 | - Write an efficient method that takes stockPricesYesterday and returns the best profit I could have made from 1 purchase and 1 sale of 1 Apple stock yesterday. 75 | - Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. 76 | 77 | For example, given 78 | s = "leetcode", 79 | dict = ["leet", "code"]. 80 | 81 | Return true because "leetcode" can be segmented as "leet code". 82 | - Given an array of Ints find a maximum sum of non adjacent elements. 83 | for ex. arr = [1,0,3,9,2] then ans would be 10 = 1 + 9 (non adjacent element) . 84 | - Given an input string of numbers like 121, find all permutations of that number in the same order for the corresponding letters for each number so 121 => 1 2 1, 12 1, and 1 21 which is ABA, LA, and AT . 85 | - For a given string and dictionary, how many sentences can you make from the string, such that all the words are contained in the dictionary. 86 | - Given string a and b, with b containing all distinct characters, find the longest common subsequence's length. 87 | - Given a 4\*n block, find number of different ways of filling it with 1*2 smaller blocks. Rotation of smaller blocks is allowed. 88 | - You have a dictionary of words. Create a matrix of letters such that each row of the matrix is a word and each column of the matrix is a word. 89 | - You have a sorted array of integers. Find the element where the array index is equal to the value of the corresponding element. Or return that no such element exists. 90 | - Given an array of numbers, for every index i, find nearest index j such that a[j] > a[i].If such an index doesn’t exist for i, ­1 should be printed. 91 | - Given a string A and B, find the smallest substring of A that contains all the characters from B. (implement solution in O(n), keep in mind chars in B can repeat). 92 | - Given a character limit and a message, split the message up into annotated chunks without cutting words as, 93 | 94 | For example when sending the SMS 95 | 96 | "Hi Sivasrinivas, your Uber is arriving now!" 97 | 98 | with char limit 25, 99 | 100 | you should get 101 | 102 | ["Hi Sivasrinivas,(1/3)", "your Uber is arriving(2/3)", "now!(3/3)"]. 103 | - Write a function to tell us if a full deck of cards shuffledDeck is a single riffle of two other halves half1 and half2. 104 | - Given a number N. print in how many ways it can be represented as N = a+b+c+d , 1< =a< =b< =c< = d; 1<=N< = 5000 105 | - Given two number l and r (l<=r<=10^6) find most frequent digit among all prime numbers between l and r inclusive. if frequency is same print highest digit. 106 | 107 | 108 | ---- 109 | Technical Interview Questions 110 |
111 | Data Structures and Algorithms 112 | - WAP to return mirror of a binary tree. 113 | - Implement dictionary. 114 | - Sparse vector product. Given two very large sparse vectors, 115 | 1. find the data structure to store them 116 | 2. calculate the product of them 117 | - Design a HashMap in Java. Implement put, get, remove, resize methods. 118 | - Implement LRU Cache. 119 | - Program to check whether a given graph is Bipartite or not. 120 | - Given a list of number, return all subsets of the list. 121 | - Serialize & Deserialize a binary tree. 122 | - Design a data structure that supports insert, delete, search and getRandom in constant time. 123 | - Design a data structure that supports 3 below operations: 124 | 1. GetNextId() : It returns the auto incremental next id. i.e 1 then 2 then 3 then 4 125 | 2. Acknolwdge(int i) : receives the acknowledgement of the id that was sent by GetNextId 126 | 3. GetIdLevel() : It returns the minimum id that has not been acknowledged. 127 | - Given input which is vector of log entries of some online system each entry is something like (user_name, login_time, logout_time), come up with an algorithm with outputs number of users logged in the system at each time slot in the input, output should contain only the time slot which are in the input. 128 | - Given a string, determine if a permutation of a string can form a palindrome. 129 | - Implement a timer using queue. 130 | - Implement boggle(Find all possible words in a board of characters). 131 | - Implement a map data structure using a binary search tree. It should have the functions Get, Set, and Size. 132 | - Implement the substring method. 133 | - Create a data structure that stores integers, let then add, delete. It also should be be able to return the minimum diff value of the current integers. 134 | - Given a 2D array of either '\' or '/', find out how many pieces this rectangle is divided into graphically. 135 | For a 2X2 matrix with 136 | ``` 137 | /\ 138 | \/ 139 | ``` 140 | The matrix split into 5 pieces - the diamond in middle and the four corners. Return 5 as the answer. 141 | - Find if a set of meetings overlap. Meeting has a starttime and an endtime with accuracy to minute. All meetings take place in the same day. Do this in O(n) time. 142 | - Design classes to represent the following problem and solve the questions 1,2,3 143 | A user might have some outstanding auto loan amount and you have 3 types of offers: personal loan, credit card and auto loan offers. You need to provide the user 144 | with the following details: 145 | 1. Send user all the offers to the user 146 | 2. Send user all eligible offers (where minCreditScore < userCreditScore < maxCreditScore) 147 | 3. Send user all offers which satisfied 2) and where the (userOutStandingLoanAmount < maxOfferedAutoLoanAmount) 148 | - Add a third dimension of time to a hashmap , so ur hashmap will look something like this - HashMap where t is a float value. Implement the get and put methods to this map. The get method should be something like - map.get(K,t) which should give us the value. If t does not exists then map should return the closest t' such that t' is smaller than t. 149 | 150 | For example, if map contains (K,1,V1) and (K,2,V2) and the user does a get(k,1.5) then the output should be v1 as 1 is the next smallest number to 1.5 151 | - Implement search in contacts list when the keyboard type is T9 (predictive text). 152 | - Given a picture of square with a bunch of horizontal and vertical lines in it (lines are not necessarily spanning the full square length, in other words think of a fine grid with many holes in it), design data structure(s) representing the data and a function that returns a number of squares pictured. (actual implementation expected). 153 | - Write a function to check that a binary tree is a valid binary search tree. 154 | - Write a method getProductsOfAllIntsExceptAtIndex() that takes an array of integers and returns an array of the products. i.e,find the product of every integer except the integer at that index. 155 | - Implement queue with two stacks. 156 | - You have a homogeneous fixed-size data structure ("arena") to house structs that should do X (vague description). Define the struct, a function that stores it in the arena, and a function that retrieves it from the arena. 157 | - WAP to find the k smallest values in a binary search tree. 158 | - Program to find the distance between two keys in a binary tree, no parent pointers are given. 159 |

160 | Miscellaneous 161 | 162 | - There is a primary machine and a secondary(backup machine). Write a program to sync files from primary to backup machine. 163 | - Design an alarm system for a driverless car. 164 | - Design an algorithm to operate elevators to pick up people on different floors of a building. 165 | - Given a restaurant menu and a budget, output all the possible ways to use up the budget. 166 | - How would you find the words that became obsolete in English language between 16th and 17th century? You may use a search engine. 167 | - Design a price surge system, both at a high level and the architecture 168 | - Design a distributed system for sorting of large files. 169 | - Design Netflix 170 | - Design Online Spreadsheets 171 | - Design Twitter 172 | 173 | 174 | ## Feel free to show your love :heart: by putting a star :star: on this project :v: . 175 | -------------------------------------------------------------------------------- /Verizon/README.md: -------------------------------------------------------------------------------- 1 | # Verizon Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithm](#dsalg) 5 | * [Miscellaneous](#misc) 6 | * [References](#ref) 7 | ____ 8 | Coding round questions
9 | - You have been given an integer n, you have to find all the prime numbers between 1 and n(both included). 10 | 11 | Sample: 12 | Input: 13 | n=12 14 | Output: 15 | 5 16 | Solution: 17 | 2, 3, 5, 7, 11 18 |
19 | 20 | - You have to implement a stack with following operations 21 | 1. Push 22 | 2. Pop 23 | 3. Getting the topmost element 24 | 4. Checking whether the stack is empty or not 25 | 5. Extracting the minimum element from stack in O(1) time. 26 |
27 | ____ 28 | Technical Interview Questions
29 | Data Structures and Algorithm
30 | 31 | - You have been given a range of numbers from 1 to n with some numbers missing from it. You have to find which numbers are missing. 32 | 33 | Sample: 34 | Input: 35 | 1 2 4 6 7 8 12 13 14 16 36 | Output: 37 | 3 5 9 10 11 15 38 |
39 | Miscellaneous
40 | 41 | - What is polymorphism. 42 | - What is the difference between compile time and run time polymorphism. 43 | - what are dangling pointers. 44 | - What is the concept of memory leak. 45 | - Difference between C++ and Java. 46 | - Can a constructor be virtual. 47 | - How does partition function of quick sort works. 48 | - Difference betweena a process and a thread. -------------------------------------------------------------------------------- /Walmart Labs/README.md: -------------------------------------------------------------------------------- 1 | # Walmart Labs Interview Questions 2 | 3 | - [Coding Round Questions](#coding) 4 | - [Technical Interview Questions](#tech) 5 | - [Data Structures and Algorithms](#dsalg) 6 | - [DBMS](#dbms) 7 | - [Operating System](#os) 8 | - [System Design](#design) 9 | - [Java](#java) 10 | 11 | --- 12 | 13 | Coding round questions 14 |
15 | 16 | - Given a grid of 1s and 0s, the area of an island is the number of cells with a value 1 in the island (a group of 1's). Find the island with maximum area. 17 | - Detect Cycle in a Directed Graph. 18 | - Least Frequently Used (LFU) Cache Implementation. 19 |
20 | 21 | Technical Interview Questions 22 |
23 | Data Structures and Algorithms 24 | 25 | - Given an array, find the subarray with the maximum sum. Also find the position (indecies) of the subarray with maximum sum. Do the same in single pass. 26 | - Given a grid (NxN), print all possible paths from top left (0,0) to bottom right (N-1,N-1). Only allowed movements at any cell are allowed are bottom and right. Explain Time Complexity. 27 | 28 |
29 | DBMS 30 | 31 | - Explain sharding techniques. 32 | 33 |
34 | Operating System 35 | 36 | - Explain about deadlocks. 37 | 38 |
39 | System Design 40 | 41 | - What is CDN. Explain with a sample, the flow of a website loading. 42 | 43 |
44 | Java 45 | 46 | - Concepts of OOPS. 47 | - Explain SOLID Principle. 48 | - What is Desing Patterns and why we use them. 49 | - Code Singleton Pattern. (Make it Thread Safe without using synchronized keyword) 50 | - Reentrant Locks in Java. 51 | - What is a framework. Spring vs Springboot. 52 | - Explain the internal working of HashMap in Java. 53 | - Implement HashMap in Java ( Use Generics) 54 | 55 |
-------------------------------------------------------------------------------- /Yatra.com/README.md: -------------------------------------------------------------------------------- 1 | # Yatra.com Interview Questions 2 | 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [Miscellaneous](#misc) 9 | * [References](#ref) 10 | ____ 11 | Coding round questions
12 | 13 | - Two arrays are provided. The second array is to be traversed and number(count) of values smaller/equal than each element of the second array in the first array are to be printed as output. 14 | 15 | - One integer array is provided, and a value ‘k’ is given. You have to print the number(count) 16 | of sub-arrays whose product is less than ‘k’. 17 | 18 | - Given three sorted array, find the numbers which are common in all three arrays. 19 | 20 | - Find bitonic point in given bitonic sequence. 21 | 22 | - A 2-D matrix is provided consisting of values 0,1 and 2 only. 0 Represents blocked path, 1 represents open path and 2 represents cheese & open path. Now, Tom stands at (0,0) and location of Jerry is given .Tom needs to collect all the cheese and catch Jerry optimally. 23 | - Given two strings s1 and s2, we need to find the minimum number of manipulations required to make two strings anagram without deleting any character. 24 | - Given a list of strings, where each string is composed of different combinations of (, ), {, }, [, ]. Verify the validity of the arrangement. ()[]{} Is valid, ())({} is not valid. 25 | 26 | - Given a string return all possible subsequences which start with vowel and end with consonant. 27 | For input abc – ab, ac, abc 28 | For input aab – ab, aab 29 | 30 | - An array is given which contains the age of your friends , if the age of the friend is greater than any neighbor then he will get more chocolate than him. You have to find the number of chocolates for distributing each one.(Birthday Problem) 31 | 32 | - Given an array A[] consisting 0s, 1s and 2s, write a function that sorts A[]. The functions should put all 0s first, then all 1s and all 2s in last. 33 | 34 | - Given an array of integers, find the nearest smaller number for every element such that smaller element is on left side. 35 | 36 | - Write a program to reverse words in a given string. 37 | 38 | - Given a Matrix with 0’s and 1’s in sorted order. design an algorithm to return row index with maximum number of 1’s. after That he modified the ques that some rows are sorted in increasing order and some in decreasing order. 39 | 40 | - Given two arrays of n+m and n size. n+m size array only have m elements and n size array have n elements. Design an algorithm to shift smaller array element in larger array also larger array should be sorted. 41 | 42 | - There are 2 ^ n sorted arrays of size k . Merge them to form a single sorted array. 43 | 44 | - Given an array and integer.Find whether b is present in a[] or not.If present,then double the value of b and search again. We repeat these steps until b is not found. Finally we return value of b. 45 | 46 | - Given an array that is sorted and then rotated around an unknown point. Find if array has a pair with given sum.It may be assumed that all elements in array are distinct. 47 | 48 | - Given a string which contains vowels and consonants. Find the number of substrings which start with vowel and ends with consonant. 49 | 50 | - Given a 2d grid map of 'Y's (Grass) and 'N's (no Grass) where connected grass blocks forms a field. Two fields are separated field by 'no grass' and is formed by connecting grass blocks horizontally or vertically. Only a cow or sheep can graze in one field. Find the count of all the combinations where the number of sheep is even. 51 | ``` 52 | e.g. Grid is YYYN 53 | NNYN 54 | NYNY 55 | NNNY 56 | Here the number of fields is 3. 57 | ``` 58 | - Given an array of distinct integers and a sum value. Find count of triplets with sum smaller than given sum value. Expected Time Complexity is O(n2). 59 | 60 | - Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. 61 | 62 | - Given two strings in lowercase, the task is to make them anagram. The only allowed operation is to modify a character from any string. Find minimum number of characters to be modified to make both the strings anagram? 63 | If they cannot be modified to anagrams return -1 (viz. when strings are unequal in length.). 64 | 65 | ---- 66 | Technical Interview Questions 67 |
68 | Data Structures and Algorithms 69 | - Write a code to reverse a linked list. 70 | 71 | - You are given a list of songs and you have to select a random song and play it, but the condition was that you can not play a song twice.Consider there is a function play() which takes song as parameter and plays it. 72 | 73 | - Rotate a 2D-matrix by 90 degree without using extra space. 74 | 75 | - Given a binary tree, Do the reverse level order traversal. 76 | 77 | - Given coordinates of points find closest pair points distance. 78 | 79 | - Given an array find two elements whose sum equal to zero. 80 | 81 | - Reverse the elements of stack without using another stack, queue and array. 82 | 83 | - Implement Manacher's algorithm. 84 | 85 | - Find a pair of elements swapping which makes sum of two arrays same. If not possible, return -1. Time complexity should be less than O(n^2). 86 | 87 | - Perform reverse level order traversal using TreeMap(Java). 88 | 89 | - Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree 90 | 91 | - In a binary tree, find the left facing elements with recursion and without recursion. 92 | 93 | - Given 2D array horizontally and vertically sorted find a given element. 94 | 95 | - Compress a given string "aabbbccc" to "a2b3c3";no extra space to be used . 96 | 97 | - Rotation of the sorted array through some pivot. 98 | 99 | - Find the number in an array which is appearing odd number of times. 100 | 101 | - Find whether two strings are anagrams of each other or not.What would happen if strings are very large. 102 | 103 | - Level Order traversal of a binary tree. 104 | 105 | - Given a binary tree, find whether all leaves are at same level or not. 106 | 107 | - Check whether given linked list is palindrome or not.Write optimized code handling all edge cases. 108 | 109 | - Reverse K blocks of nodes in linked list. 110 | 111 | - Find min element in stack in O(1). 112 | 113 | - Implement counting sort. 114 | 115 | - Given a set of start date and end date, design a data structure to return the set given date falls in. 116 | 117 | - Find second non-repeating element in an array. 118 | 119 | - Clone a binary tree. Node object is immutable. 120 | 121 | - Implement Kadane's Algorithm. 122 | 123 | - Implement Trie with insert, search, and startsWith methods. 124 | 125 | - Find the median of unsorted array in linear time. 126 | 127 | - Write code for Dutch National Flag problem. 128 | 129 | - Minimum value in a max heap. 130 | 131 | - Design and implement a data structure for Least Recently Used (LRU) cache. 132 | 133 | - Delete the odd elements from a linked list. 134 | 135 | - Find the minimum difference between two elements. But the difference must be calculated between the current element and the elements on the right hand side of the element. 136 | 137 | - Implement a compression algorithm e.g. if data is 10GB in size and my storage is only 1 GB 138 | 139 | - Find the last repeating element in integer array O(n). 140 | 141 | - Check whether a binary tree is binary search tree. 142 |

143 | DBMS 144 | - Given a table with (empId, deptId, Salary ) make a sql query which list the maximum salary for each department. 145 | 146 | - Given a table (EmpID, Salary) make a generic sql query so that i can get the nth highest salary. 147 | 148 | - Design tables for getting all employees under manager. 149 | 150 | - What is database normalization? What are its advantages and disadvantages? 151 | 152 | - Write SQL commands to create a table appropriate for representing students as well 153 | as SQL commands that illustrate how to add, delete, and update students, as well as 154 | search for students by GPA with results sorted by GPA. 155 | 156 | - What is a SQL join? Suppose you have a table of courses and a table of 157 | students. How might a SQL join arise naturally in such a database? 158 |
159 |
160 | Operating System 161 | 162 | - What is deadlock ?What are the necessary conditions for deadlock? 163 | 164 | - Algo for Readers-Writers problem. 165 | 166 | - What is a process and process table? What are different states of process? 167 | 168 | - What is Virtual Memory? How is it implemented? 169 | 170 | - Differences between mutex and semphore? 171 | 172 | - What is difference between micro kernel and macro kernel? 173 |
174 |
175 | Miscellaneous 176 | 177 | - Difference between HashMap & LinkedHashMap. 178 | 179 | - What is Hashing, Hash table ? 180 | 181 | - Algorithm for Level order traversal of BST without using Queue Data structure. 182 | 183 | - Cloning a linked list with random pointers. 184 | 185 | - Given a base string, find whether the input string is rotation of base string. 186 | 187 | - Draw Class diagram of Training and Placement Cell of your college. 188 | --- 189 | 190 | 191 | ## Feel free to show your love :heart: by putting a star :star: on this project :v: . 192 | 193 | References 194 | - [Geeksforgeeks](http://www.geeksforgeeks.org/) 195 | - [Career Cup](https://www.careercup.com/) 196 | - [Glassdoor](https://www.glassdoor.co.in/index.htm) 197 | 198 | 199 | -------------------------------------------------------------------------------- /Yelp/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Yelp Interview Questions 3 | * [Coding Round Questions](#coding) 4 | * [Technical Interview Questions](#tech) 5 | * [Data Structures and Algorithms](#dsalg) 6 | * [DBMS](#dbms) 7 | * [Operating System](#os) 8 | * [Miscellaneous](#misc) 9 | * [References](#ref) 10 | ____ 11 | Coding round questions
12 | - There is a HashMap contains 7 Keys, which is Monday through Sunday. Each key is corresponding to a List of (Start time, end time) pairs. The pairs is unsorted. Merge the time slots that are adjacent. And finally return another HashMap that contains the same structure but with merged time slots. 13 | - Given the arraylist input, find the number of dishes with unique ingredients 14 | class meals{ 15 | String cuisine; 16 | ArrayList dish = new ArrayList(); 17 | meals(String s, String arr[]){ 18 | cuisine = s; 19 | for(String i : arr){ 20 | dish.add(i); 21 | } 22 | } 23 | } 24 | - Find topic occurrences in reviews 25 | - Find the closest palindrome to a given number, number can be negative. 26 | 1234 -> 1221 27 | 101 -> 99 28 | - Find the median of ratings in an array of objects giving businesss name and ratings. 29 | - Remove extra spaces from string 30 | - generate valid parenthesis 31 | - group anagrams 32 | - Leet code medium - Graph Traversal 33 | - Given a string query and list of correct word dictionary, find a word in a word dictionary that has the least diff 34 | - Count the number of weakly connected components in a graph 35 | - Given an array of string array, find the string that occurs most and return. If there are ties, just return an array of string. 36 | - remove duplicate entries from a linked list 37 | - sorting the business info which looks like[{"name1", 10001},{"name2", 10004},{"name3", 10002}...] 38 | 39 | --- 40 | Technical Interview Questions 41 |
42 | Data Structures and Algorithms 43 | - Write a program to pair groups of people into randomized pairs, assign leftover people to pairs to make a group of three. 44 | - Given a set of users subscribed data and several updated data sorted by time, return a list of users whose subscribe status is changed after the update. 45 | - Giving a list of the event name, occurrence, and business id. And return the business id with at least two event name, and has a greater number of the event than the average across all business. 46 | - How many times do strings in a list exist in three sentences? 47 | - Giving a list of the event name, occurrence, and business id. And return the business id with at least two event name, and has a greater number of the event than the average across all business. 48 | - Prefix Matching 49 | - Find the median of restaurant's review rating scores 50 | - Merge intervals. find keyword from the customers' review 51 | - Find out longest substring without duplicates in a string. 52 | - Top K frequent elements, how would you run it on multiple nodes 53 | - Given a sequence of words, print all anagrams together 54 | - List manipulation using language of your preference 55 | - two sum, then follow up with k sum. 56 | 57 | 58 | DBMS 59 | - Some questions about database principle and system design 60 |
61 | 62 | 63 | Operating System 64 | - Should you encrypt and then compress, or compress and then encrypt? why? 65 | - All interviews had many UNIX specific trivia style questions which required knowledge of UNIX utilities and their options. 66 | - What happens when I hit submit on URL of a browser? (e.g. google.com on Safari). 67 | - What port does an http server run on? 68 | - Explain Servlet and JSP 69 | - Given a list of IP address and corresponding hits, asked how to get the top 10 hit IP address 70 |
71 | 72 | Miscellaneous 73 | - One of the three servers is slow. What can be the possible reasons and how would you take care of these things? 74 | - How can you find all instances of a class 75 | "'X' is a tool we use here internally, it does 'Y'. Here's some skeleton code, implement these requirements." 76 | - What changes would you like to make on Yelp website 77 | - Output one review for the business that is the most representative of all the other reviews. How would you evaluate your model 78 | - Explain Spring and Hibernate 79 | - Projects and Internship 80 | - Tell me about your recent project? 81 | 82 | 83 | -------------------------------------------------------------------------------- /Zomato/README.md: -------------------------------------------------------------------------------- 1 | # Zomato Interview Questions 2 | * [Coding Round Questions](#coding) 3 | * [Technical Interview Questions](#tech) 4 | * [Data Structures and Algorithms](#dsalg) 5 | * [DBMS](#dbms) 6 | * [Operating System](#os) 7 | * [Miscellaneous](#misc) 8 | * [References](#ref) 9 | ____ 10 | Coding round questions
11 | - Find total number of set bit in numbers upto n. 12 | - Reverse the each word of the given paragraph. 13 | - WAP to find height of BST. 14 | - Form the maximum number from the elements of the array. 15 | - Detect if two line segments intersect each other. 16 | - Write a code for a 2-D array such that it there’s a zero, it overwrites all the elements of the corresponding row and column as zero. 17 | - Write a code to find the previous shorter element in an array. 18 | - Given a world map such that all the places covered via land are represented by ‘L’ and rest by ‘W’. Since world is spherical hence rows and columns are cyclic (before row 1 row n comes and after row n row 1 same for column). Count the number of islands. 19 | 20 | ---- 21 | Technical Interview Questions 22 | 23 | Data Structures and Algorithms 24 | - Detect and remove loop in linked list. Proof of hare and tortoise algo. 25 | - Detect if two line segments intersect each other. 26 | - A cylinder is rolled in the form of a sheet. Given two points find out the distance between them. 27 | - WAP to find k nearest points. 28 | - Design LRU cache. 29 | - Find the minimum number of switches you have to press to turn on all the bulbs. 30 | - Delete a node with a pointer in linked list. 31 | - Given a dictionary list possible approaches for finding whether key exists in the dictionary or not. 32 | - Create a stack in java. 33 | - Longest palindromic substring. 34 | - WAP to check whether tree is symmetric or not. 35 | - Find the sum of odd positioned nodes of a BST. 36 | 37 | DBMS 38 | - What is indexing and how is it implemented internally. 39 | - Given two DBs A and B and one table T ( Columns C1, C2)in both DBs, C1 was primary key in them and C2 was another indexed column in DB B. Select query will run on both DBs i.e Select C2 from T where C1=X. Which DB will serve faster data? 40 | 41 | Miscellaneous 42 | - If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? 43 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /check.java: -------------------------------------------------------------------------------- 1 | public class check 2 | { 3 | public static void main(String args[]) 4 | { 5 | System.out.println("hello world"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/splash.png -------------------------------------------------------------------------------- /thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twowaits/SDE-Interview-Questions/664d5e6929d1a744fb6b22dcd0050d98ccfa79d6/thumbnail.png --------------------------------------------------------------------------------