diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..00741cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +.idea/ \ No newline at end of file diff --git a/Amazon/README.md b/Amazon/README.md new file mode 100644 index 0000000..0c093bc --- /dev/null +++ b/Amazon/README.md @@ -0,0 +1,47 @@ + +# Amazon Interview Questions +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [System Design](#design) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+- Given an array of distinct elements and a number x, find if there is a pair with product equal to x. +- 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. +- Given a number, find its corresponding Roman numeral. +---- +Technical Interview Questions +
+Data Structures and Algorithms + +

+DBMS + + + +
+
+Operating System + +
+
+System Design +1. Design a system that controls traffic lights with below assumptions: + + - A group of traffic lights has two components: main lights and pedestrian lights. + - Main traffic lights has three colors: red, yellow and green. + - Pedestrian lights has two colors: red and green. + - Pedestrian lights' colors are reversed from main lights: + - Main: red/yellow - pedestrian's: green + - Main: green - pedestrian: red + - There is a button for pedestrian lights, if button is pushed in advance, pedestrian's lights change colors according to the main ones, if button isn't pushed, pedestrian's lights remain red. + - A typical junction has 4 group of lights. + - 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. + +
+
+Miscellaneous diff --git a/Box/README.md b/Box/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Box/README.md @@ -0,0 +1 @@ + diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..93a157e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +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. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +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. + +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. + +## Scope + +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. + +## Enforcement + +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. + +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. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4ec1ee5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ +## Contribution Guidelines + +Please make sure that your pull request adheres to the following guidelines: +- For each company, make a separate pull request. +- Pull requests pertaining to grammatical mistakes, removing whitespaces or renaming are highly discouraged. +- The pull request and commit message should include what was added/removed. +- Ensure that you don't replicate the same content. +- Do not forget to mention the references in the footer section. +- Given below is a general template for adding questions of a company not listed in the project. +- Each article will consist of three sections:- Coding round questions, Technical Interview Questions and References. +- Coding round comprises questions asked in online/paper coding round. Typically, this is the first round of interview. +- Technical Interview Questions includes DS Algo, DBMS, OS and Miscellaneous sections. +- Miscellaneous may include questions from design patterns, software development, system design and Object Oriented Programming. + +**Note:** - If there is a telephonic round, add it before coding round questions as given below. + + +Happy Coding! :v: + +## Sample template + +## COMPANY_NAME Interview Questions +* [Telephonic Round Questions](#telephonic) +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+ +- Questions in this section. + +---- +Technical Interview Questions +
+Data Structures and Algorithms + +- Questions in this section. +
+DBMS + +- Questions in this section. +
+Operating System + +- Questions in this section. +
+Miscellaneous + +- Questions in this section. diff --git a/Expedia/README.md b/Expedia/README.md new file mode 100644 index 0000000..07d2343 --- /dev/null +++ b/Expedia/README.md @@ -0,0 +1,84 @@ +# Expedia Interview Questions +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+- Given a collection of intervals, merge all overlapping intervals. + ``` + For example, + Given [1,3],[2,6],[8,10],[15,18], + return [1,6],[8,10],[15,18] + ``` +- Given an input string, reverse the string word by word. + ``` + For example, + Given s = "the sky is blue", + return "blue is sky the". + ``` +- Find maximum sum of subarray. + +- We define a `k-subsequence` of an array as follows: + + 1) it is a subsequence of consecutive elements in the array. + + 2) the sum of the subsequence's elements s, is evenly divisible by k`(i.e. s % k == 0)`. + Given an integer and input array, find out the number of k-subsequences. + Example: k=3 and array be `[1 2 3 4 1] ` + Output: 4 `({1 2},{1,2,3},{2,3,4},{3})`. + +- 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. +e.g: ``[2 3 5 3 7 9 5 3 7]`` +Output: ``[3 3 3 5 5 7 7 2 9]`` + +- 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. + Example: Str1 = "A Statement is a Statement" + Str2 = "Statement a" + Output: "A is Statement" +- You are given an integer. Print its 4th least significant bit. + +- 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: +1.) 1 unit +2.) n units +Find the minimum number of hops Harry would need to reach the top of the pole. + +- Given two positive floating point numbers `(x,y)`, calculate `x/y` to within a specified epsilon without using in-built functions. + +- Write a recursive function to generate Pascal triangle. + +- 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}`. + +- Given a +ve integer, find the next highest number in the numerical order using the same numbers present in the given integer. + Example : 218765 + Output : 251678 + +- Implement atoi to convert a string to an integer. + +- There is an infinite integer grid at which N people have their houses on. They decide to unite at +a common meeting place, which is someone's house. +From any given cell, all 8 adjacent cells are reachable in 1 unit of time. +eg: (x,y) can be reached from (x-1,y+1) in a single unit of time. +Find a common meeting place which minimises the sum of the travel times of all the persons. + + Input Format: + N + The following N lines will contain two integers saying the x & y coordinate of the i-th person. + + Output Format: + M M = min sum of all travel times; +- Ashley has a bunch of coins she wants to arrange into staircases. She starts with 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. + + For example, if she's got 6 coins, she can create a stairase with 1 coin in the top row, 2 in the second and 3 in the third. She can complete 3 rows. It would take atleast 4 more coins, 10 coins total, for her to be able to create a 4th complete row. +---- +Technical Interview Questions + +- 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 still remain 1/sec. + +Miscellaneous +- What is the __init__.py file in Python? +- What does the double underscore represent in Python? +- Puzzle: You are given 8 identical looking balls. One of them is heavier than the rest of the 7 (all the others weigh exactly the same). You a provided with a simple mechanical balance and you are restricted to only 2 uses. Find the heavier ball. diff --git a/Facebook/README.md b/Facebook/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Facebook/README.md @@ -0,0 +1 @@ + diff --git a/Flipkart/README.md b/Flipkart/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Flipkart/README.md @@ -0,0 +1 @@ + diff --git a/Google/README.md b/Google/README.md new file mode 100644 index 0000000..37c586d --- /dev/null +++ b/Google/README.md @@ -0,0 +1,30 @@ + +# Google Interview Questions + +* [Telephonic Round Questions](#quiz) +* [Coding Round Questions](#coding) + +____ + + +Telephonic Round Questions
+ +- What is the approximate value of 2 to the power of 24. +- Average and Worst case time complexity of Merge Sort and Quick Sort. +- What does the *.find()* function of C++ Collection returns when the item is not there in the collection. +- Mention few implementation of Map interface in Java. +- What is the advantage of using Heapsort over Mergesort ? +____ + + +Coding round questions
+ +- 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). +- 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. +- 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 : + + A should be smaller than B. + Number of digits should be same. + By rotating A any number of times in one direction, we should get B. + +- 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 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}. diff --git a/Grab/README.md b/Grab/README.md new file mode 100644 index 0000000..4aed633 --- /dev/null +++ b/Grab/README.md @@ -0,0 +1,100 @@ +# Grab Interview Questions +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+- In an integer array, find a pair of numbers which add up to a given number. +- Write a function that add 1 to LinkedList number + ``` + [2]->[4]->[5]->[7]->[3]->[6] + after plus 1 + [2]->[4]->[5]->[7]->[3]->[7] + ``` +- Find the count of all perfect squares between two numbers a and b. +- Given an array of N integers, find the longest leading fragment of array which contains equal no. of X and Y. Expected time complexity is O(n). +- There're 3 kinds of bus ticket. + 1: ticket 1 cost 2 and can be used for a day. + 2: ticket 2 cost 7 and can be used for a consecutive 7 days. + 3: ticket 3 cost 25 can be used for a month. Assume month here means 30 consecutive days. + + Now there's a 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}. + Obviously the final day is 30th and first day is 1st. + + So for any given array from a person to travel, how can this person cost least ? +- Given N rows of seats in a movie theater, each row with seats labeled A to K some seats are reserved. A 3 person family want seats next to each other (seats across aisle is not allowed), return all available options. + + Reserved seat will be given like "1A 2B 40G". +- Design a class to calculate moving average of last N numbers in a stream of real numbers. +- Format a string of numbers to display a currency - example" "1234.678" to "1,234.68". +- Given an array find the next greater element. +- Find the distance between any two nodes of the tree. +- 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: + http://registry.npmjs.org/forever/latest + This request will result in a JSON, containing many fields, including dependencies field: + ```dependencies: { + cliff: "~0.1.9", + clone: "^1.0.2", + colors: "~0.6.2", + flatiron: "~0.4.2", + forever-monitor: "~1.7.0", + ... + } + ``` + + This is a list of direct dependencies of an NPM package. + + 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. + + 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). + + Include a list of tools that needs to be installed to run your code and instructions on how to run your program. + + NOTE: + + 1. Don’t try to code your solution in browser environment, response from NPM API will not pass CORS checks in browser. + 2. You should not care about package versions (only need the latest). + 3. You should not care about development dependencies. + 4. The function should return the array (or a promise of the array if your function is async), instead of just printing the result. + + Base level expectations: + + Code correctness + Code readability + Error-handling: do not assume your calls to the endpoint will always succeed + + Bonus points for: + + Use of concurrency + + +---- +Technical Interview Questions +
+Data Structures and Algorithms +- Minimum Element in Stack. +- Top view of tree. +- Flip the ith bit without using ~. +- Queue using two stacks. +- Right view of a binary search tree. +- Find out the last nth node in a linked list. +- Write code for column wise tree traversal. +- Reverse a sentence of words. +- How do you check that a given binary tree is a valid balanced binary search tree? +- You receive a bit stream (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. + +
+DBMS + +- DB Concurrency. +
+Miscellaneous + +- What is the use of join() and yield() in Thread. +- What is a singleton class and how to protect it from reflection? +- Explain JVM architecture. +- What is Stack Frame ? diff --git a/Groupon/README.md b/Groupon/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Groupon/README.md @@ -0,0 +1 @@ + diff --git a/Intuit/README.md b/Intuit/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Intuit/README.md @@ -0,0 +1 @@ + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6d93ef2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Rishabh Maurya + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LinkedIn/README.md b/LinkedIn/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/LinkedIn/README.md @@ -0,0 +1 @@ + diff --git a/Microsoft/README.md b/Microsoft/README.md new file mode 100644 index 0000000..1aa7f82 --- /dev/null +++ b/Microsoft/README.md @@ -0,0 +1,13 @@ + +# Microsoft Interview Questions +* [Coding Round Questions](#coding) + +____ +Coding round questions
+ +- Write a program to reverse digits of an integer. +- Write a function that calculates the day of the week for any particular date in the past or future. +- Given a binary tree and data value of a node. The task is to find the sum of cousin nodes of given node. If given node has no cousins then return -1. +-Given a positive number N. The task is to round N to nearest multiple of 10. Number can be so big and can contains 1000 of digits. +- At an ATM Machine, you are given a 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. +- 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, than 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. \ No newline at end of file diff --git a/MobiKwik/README.md b/MobiKwik/README.md new file mode 100644 index 0000000..9007134 --- /dev/null +++ b/MobiKwik/README.md @@ -0,0 +1,84 @@ +# Mobikwik Interview Questions +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+- Given an array of distinct elements, rearrange the elements of array in zig-zag fashion in O(n) time. The converted array should be in form a < b > c < d > e < f. +- Find k max in array and print it. +- 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. +- 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. +- Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. +- Convert string to palindrome string with minimum insertions. +- 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 diamond at that location with a path -1 denotes that the path is blocked. Now you have start from 0,0 and reach to last cell & then return back to 0,0 collecting maximum no of diamonds. While going to last cell you can move only right and down. While returning back you can move only left and up. +- Build a superstack. + + Print value of "peak" after each operation. + n : the number of operations + POP : get the value of "peak", if there is no more value after pop, + then print "EMPTY". + PUSH d : put the new value(d) after "peak", then print the value of "peak". + INC x d : add the new value(d) from index 0 to x elements, then print + the value of "peak". +---- +Technical Interview Questions + +Data Structures and Algorithms +- Given a binary tree, print its top, bottom, left and right view. +- Implement queue with two stacks. +- Level order traversal. +- Find the LCA of two nodes in BST. +- Find successor and predecessor of node in BST. +- Write a program for solving Tower of Hanoi problem. +- Write program for string reversal through recursion. +- WAP to reverse Doubly LL. +- From a given string find the maximum length substring which is a palindrome. +- Kruskal's MST algorithm. +- Dijkstra's Algorithm. +- Write codes for Heap sort, Radix sort and Merge sort. +- Find the whether the linked list has a loop or not. +- Find the meeting point of the loop in linked list. +- Reverse a linked list by recursion. +- Reverse a stack without using extra memory. +- Make balanced BST from given sorted linked list. +- Given a string, find the maximum substring having equal number of 1's and equal number of 0's. +- Find the total number of ways in which 2 x N strip can be filled with 2 x 1 brick. ( O(log n)). +- Find the elements having sum equal to k from BST in O(n) time comlexity. +- Find the maximum square submatrix from a given matrix filled with only '1'. +- Find 35/3 without using recursion. + +DBMS +- Make a normalised database of Student Database in college, right from ER to normalized relational database. +- Foreign key, primary key and the entity types. +- Indexing, clustering and joins. +- Write a query for maximum number. +- Difference between the “having by” and “group by”? + + +Miscellaneous +- Principle of OOPS. +- Mulithreading in Java. +- What is serialization? +- Briefly explain DNS, TCP, UDP, OSI layer. +- Why there is some null interface in java? What does it mean? Give me some null interfaces in JAVA? +- What is JNI? +- What is a compilation unit? +- Is string a wrapper class? +- Why Java is not 100 object oriented language? +- What is a resource bundle? +- Is Iterator a Class or Interface? What is its use? +- Why do threads block on I/O? +- What is synchronization and why is it important? +- How class level lock is acquired? +- Is null is a keyword in Java? +- What is checked and unchecked exceptions? +- Does garbage collection guarantee that a program will not run out of memory? +- What restrictions are placed on the location of a package statement within a source code file ? +- What is the immediate superclass of the Applet class? +- 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++. +- Explain compile time polymorphism and runtime polymorphism. +- What is the reason for single inheritance in Java ? diff --git a/NEC Technologies/README.md b/NEC Technologies/README.md new file mode 100644 index 0000000..c7c3a18 --- /dev/null +++ b/NEC Technologies/README.md @@ -0,0 +1,107 @@ +# NEC Technologies Interview Questions +#### Profile: Member of Technical Staff +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+- Display all numbers between 32-62 which ends with 5. +- Write a program that accepts a decimal number and outputs the binary representation of that number. +- Given ASCII values, output the string. +- You are given an m x n 2D matrix. Rotate the image by 90 degrees (anti-clockwise). +- Write a program to convert infix to postfix. +- Write a program to print transpose of a given matrix. +- Given a 2D array, find the maximum sum subarray in it. +- Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. +- 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. +- Find the second largest number. +- Find whether two strings are anagram of each other. +- Find missing number unsorted contiguous array. +- Find Number of common Guests in all parties if user give the input in the following format. +The guests list for parties is in one line separated by Comma(,). + ``` + + Input: 122,444,2223,122,1111,122,2233,123,333,333,444, + 1111,122 + Output: + 2233:1 + 2223:1 + 333:2 + 444:2 + 1111:2 + 122:4 + 123:1 + + ``` + + + +---- +Technical Interview Questions +
+Data Structures and Algorithms +- Write a recursive function to print reverse of a Linked List. +- Write a program in C/C++ to sort an Array in O(n). +- WAP to reverse a linked list. +- Implement queue. +- What are the advantages of doubly linked list. +- Various types of Hashing-Linear, Quadratic and Mid-Square. +- Decimal to Binary program using recursion. +- Find the largest Number of Array using recursion. +- WAP to sort a Linked List. +- Program for converting Little to Big Endian. +- Find the center element of a linked list? +- Print left view of Binary Search Tree. +- Implement circular linked list. +- Write a program on pallindrome linked list and stack implementation using linked list. +- Program to remove duplicates from linked list. +- Program to detect if there is any loop in linked list. +- Write program for maximum of 4 numbers in good readable, optimized code. + +

+DBMS + +- Database design using Normalization. +- What are DBMS, RDBMS and ORDBMS ? +- What is DDL, DML and DCL? +- What is clustered indexing? +- Transaction and normalisation. + +
+
+Operating System + +- Define Semaphores, Fragmentation, Normalization? +- Discuss about Deadlock, Cyclic wait. +- Paging and segmentation. +- What is thrashing? +- What is the difference between mutex and binary semaphore? +- Can you name some IPC(Inter-process communication) mechanism? + +
+
+Miscellaneous + +- How to implement a class in C? +- Difference between C and C++. +- What is template ? +- Elaborate upon the fact of inheritance in C structures. +- How can you make the same variable accessible to two C programs ? +- Define Synchronization, Desynchronization, Interim, Manipulation(Java). +- Name the technologies to store Sequential Files. +- Difference between exe and dll. +- Discussion about Volatile(in C). +- Difference between const, const pointer, const to pointer(in C). +- What is virtual function in C++? What is pure virtual function? +- What is dual core, cache m/m, throughput of processors. +- Abstract class and Interface in Java. +- What is difference between virtual and static class. +- Differentiate between Call by value, call by address, call by refrence. +- Implement operator overloading in C++? + + +## Feel free to show your love :heart: by putting a star :star: on this project :v: . diff --git a/Netflix/README.md b/Netflix/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Netflix/README.md @@ -0,0 +1 @@ + diff --git a/Ola Cabs/README.md b/Ola Cabs/README.md new file mode 100644 index 0000000..dbf1ed4 --- /dev/null +++ b/Ola Cabs/README.md @@ -0,0 +1,61 @@ + +# Ola Cabs Interview Questions +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) +* [References](#ref) +____ +Coding round questions
+- 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. + +Sample Input- +2 + +`#B#A# ##BA#` +`#B#A# #A#B#` + +Sample output- +Yes +No +

+- 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. + +Sample Input- + +1 + +5 4 3 2 1 + +Sample output – + +5 4 3 2 + +---- +Technical Interview Questions +
+Data Structures and Algorithms + +- Given a string, how many minimum rotations are needed to get back the same string. Atleast one rotation needs to be done + +Sample Input- + +2 + +abc + +abab + +Sample Output- + +3 + +2 + +

+- Find the distance between two nodes in a binary tree. + +
+
+Reference +https://www.geeksforgeeks.org/ola-interview-experience-set-15-1-year-experienced-for-sde1/ + diff --git a/Palantir/README.md b/Palantir/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Palantir/README.md @@ -0,0 +1 @@ + diff --git a/PayPal/README.md b/PayPal/README.md new file mode 100644 index 0000000..80aea0c --- /dev/null +++ b/PayPal/README.md @@ -0,0 +1,51 @@ +# PayPal Interview Questions +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+- 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. + +- 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). +- 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. + +---- +Technical Interview Questions +
+Data Structures and Algorithms +- Implement a singleton class. +- Explain binary tree and binary search tree. +- Implement stack using classes in C++. +- Longest palindromic subsequence in string. +- Detect loop in a linked list and remove it. +- Select first 3 lines of the file. Select the longest line and count the number of words in that line. +- Given an array of strings, find the shortest length palindrome. +- Find the shortest cost path in a 3x3 matrix starting from top-left to bottom-right cell. +- Design a sudoku solver. +
+ +DBMS +- Different types of joins. + +Operating System +- Explain deadlock. +
+ +Miscellaneous +- What is dangling pointer? +- What happens when you type a URL in web browser? +- What are virtual functions and virtual destructors ? +- Diamond structure problem. +- What happens when you create an object using a base class pointer? +- Why Java uses interface ? +- Difference between array and ArrayList. Advantage of array. +- Differnce between preincrement and postincrement. +- Distinguish between Hashtable and HashMap. +- How is HashMap implemented in Java? +- Draw an entity relationship diagram for a student enrolment system. +- Draw an entity relationship diagram for a airport management system. +- Does encapsulation really exist in OOPS or is it just conceptual? diff --git a/README.md b/README.md index a004114..fd41fef 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,34 @@ + +![](https://github.com/rishabh115/Interview-Questions/blob/master/thumbnail.png) + # Companies -- [Yatra.com](https://github.com/rishabh115/InterviewQuestions/blob/master/Yatra.com/README.md) + +- [Expedia](https://github.com/rishabh115/InterviewQuestions/blob/master/Expedia/README.md) + +- [Grab](https://github.com/rishabh115/InterviewQuestions/blob/master/Grab/README.md) + +- [MobiKwik](https://github.com/rishabh115/Interview-Questions/blob/master/MobiKwik/README.md) + +- [NEC Technologies](https://github.com/rishabh115/InterviewQuestions/blob/master/NEC%20Technologies/README.md) + +- [PayPal](https://github.com/rishabh115/InterviewQuestions/blob/master/PayPal/README.md) - [Samsung Research Institute](https://github.com/rishabh115/InterviewQuestions/blob/master/Samsung/README.md) + +- [Uber](https://github.com/rishabh115/InterviewQuestions/blob/master/Uber/README.md) + +- [Yatra.com](https://github.com/rishabh115/InterviewQuestions/blob/master/Yatra.com/README.md) + +- [Zomato](https://github.com/rishabh115/InterviewQuestions/blob/master/Zomato/README.md) + +#### Note: + This repo is for educational purposes only. + + +Like this repo ? Contribute new questions this hacktoberfest and be a part of it. #Hacktoberfest_2018 +#### For contributing see Contributing guidelines . +## Feel free to show your love :heart: by putting a star :star: on this project :v: . +References +- [Geeksforgeeks](http://www.geeksforgeeks.org/) +- [Career Cup](https://www.careercup.com/) +- [Glassdoor](https://www.glassdoor.co.in/index.htm) diff --git a/Samsung/README.md b/Samsung/README.md index 815de1c..2b21798 100644 --- a/Samsung/README.md +++ b/Samsung/README.md @@ -8,113 +8,124 @@ * [References](#ref) ____ Coding round questions
+#### Popular Tags +dynamic-programming +Graph +backtracking +DFS +BFS +Bipartite-Graph - Company S has developed an industrial endoscope available to explore inner part of the decrepit water pipes. It is possible to explore the inner part of the pipes putting the endoscope in a certain part of the pipe. The endoscope can be moved in the pipe only. Meanwhile, when the pipes are connected to each other, if the length of the endoscope is long enough to explore ,then it is able to inspect the connected pipes. However, we cannot observe every pipe because the length of endoscope is limited. 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: - - | S.No | Pipe | Connected to | - | -----|:-------------: | -------------:| - | 1 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/1.png ) | Up, Down, Left, Right | - | 2 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/2.png ) | Up, Down | - | 3 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/3.png ) | Left, Right | - | 4 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/4.png ) | Up, Right | - | 5 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/5.png ) | Down, Right | - | 6 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/6.png ) | Down, Left | - | 7 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/7.png ) | Up, Left | - - 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. - #### Input - In the first line, T, the number of total test cases is 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 ground water 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 of the map of ground water 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. - #### Output - 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. + | S.No | Pipe | Connected to | + | -----|:-------------: | -------------:| + | 1 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/1.png ) | Up, Down, Left, Right | + | 2 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/2.png ) | Up, Down | + | 3 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/3.png ) | Left, Right | + | 4 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/4.png ) | Up, Right | + | 5 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/5.png ) | Down, Right | + | 6 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/6.png ) | Down, Left | + | 7 | ![](https://github.com/rishabh115/InterviewQuestions/raw/master/Samsung/res/7.png ) | Up, Left | + + 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. + #### Input + In the first line, T, the number of total test cases is 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 ground water 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 of the map of ground water 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. + + #### Output + 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. - #### Constraints - 1≤ T ≤100 + #### Constraints + 1≤ T ≤100 - 1≤ N, M ≤50 + 1≤ N, M ≤50 - 0≤ X < N + 0≤ X < N - 0≤ Y < M + 0≤ Y < M + + 1≤ L ≤ 20 + +- 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 detailed version, check the following link.
+Link : https://stackoverflow.com/questions/32645046/urinal-algorithm-a-simple-optimization - 1≤ L ≤ 20 - - 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 the cases when a graph is not connected. + - You’ll be given a grid as below: + ``` + 0 1 0 2 0 --> Non highlighted part + 0 2 2 2 1 + 0 2 1 1 1 + 1 0 1 0 0 + 0 0 1 2 2 + 1 1 0 0 1 + x x S x x -->highlighted yellow + ``` + In the grid above, + 1: This cell has a coin. + 2: This cell has an enemy. + 0: It contains nothing. + The highlighted(yellow) zone is the control zone. S is a spaceship that we need to control so that we can get maximum coins. + 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. + At each time, the non-highlighted part of the grid will move down by one unit. + 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. + If we use a bomb at the very beginning, the grid will look like this: ``` - 0 1 0 2 0 --> Non highlighted part - 0 2 2 2 1 - 0 2 1 1 1 - 1 0 1 0 0 - 0 0 1 2 2 - 1 1 0 0 1 - x x S x x -->highlighted yellow + 0 1 0 2 0 --> Non highlighted part + 0 0 0 0 1 + 0 0 1 1 1 + 1 0 1 0 0 + 0 0 1 0 0 + 1 1 0 0 1 + x x S x x --> highlighted yellow + ``` + As soon as, the spaceship encounters an enemy or the entire grid has come down, the game ends. + For example, + 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)** . + After this, remain at the same position **( coins=4)**. + This is the current situation after collecting 4 coins. + ``` + 0 1 0 2 0 0 1 0 0 0 + 0 2 2 2 1 -->after using 0 0 0 0 1 + x x S x x -->bomb x x S x x ``` - In the grid above, - 1: This cell has a coin. - 2: This cell has an enemy. - 0: It contains nothing. - The highlighted(yellow) zone is the control zone. S is a spaceship that we need to control so that we can get maximum coins. - 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. - At each time, the non-highlighted part of the grid will move down by one unit. - 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. - If we use a bomb at the very beginning, the grid will look like this: - ``` - 0 1 0 2 0 --> Non highlighted part - 0 0 0 0 1 - 0 0 1 1 1 - 1 0 1 0 0 - 0 0 1 0 0 - 1 1 0 0 1 - x x S x x --> highlighted yellow - ``` - As soon as, the spaceship encounters an enemy or the entire grid has come down, the game ends. - For example, - 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)** . - After this, remain at the same position **( coins=4)**. - This is the current situation after collecting 4 coins. - ``` - 0 1 0 2 0 0 1 0 0 0 -0 2 2 2 1 -->after using 0 0 0 0 1 -x x S x x -->bomb x x S x x - ``` 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. - 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. -Here is the Task :- Find the shortest of the longest distance of research center from given locations of rare-elements. -locations are given in the matrix cell form where 1 represents roads and 0 no road.. -number of rare-element and their location was also given(number<=5) -and order of square matrix was less than equal to (20). + Here is the Task :- Find the shortest of the longest distance of research center from given locations of rare-elements. + locations are given in the matrix cell form where 1 represents roads and 0 no road.. + number of rare-element and their location was also given(number<=5) + and order of square matrix was less than equal to (20). - 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 sub trees in the original tree. The values of leaf nodes are changed to 0. - 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. - 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 whole tree. - You are given an array of integers which represents positions available and an integer c(cows). -Now you have to choose c positions such that minimum difference between cows is maximized. -``` -For example, -1 3 5 8 10 -c=3 -output: 4 -1 5 10 - ``` + Now you have to choose c positions such that minimum difference between cows is maximized. + ``` + For example, + 1 3 5 8 10 + c=3 + output: 4 + 1 5 10 + ``` - Given a Binary Tree and a node x in it, find distance of the closest leaf to x in Binary Tree. If given node itself is a leaf, then distance is 0. - Given random points in a 2-D plane, construct a convex polygon with minimum area of covering and which encompasses all the given points. - 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 -- Given a 2 D matrix where 1 represent the places where the frog can jump and 0 represent the empty spaces, the frog can move freely in horizontal direction (on 1’s only) without incurring any cost (jump).A vertical jump from a given point of the matrix to other point on the matrix can be taken (on 1’s only) with cost as the number of jumps taken. -Given a source and destination, the frog has to reach the destination minimizing the cost (jump) +- Given a 2 D matrix where 1 represent the places where the frog can jump and 0 represent the empty spaces, the frog can move freely in horizontal direction (on 1’s only) without incurring any cost (jump). A vertical jump from a given point of the matrix to other point on the matrix can be taken (on 1’s only) with cost as the number of jumps taken. + Given a source and destination, the frog has to reach the destination minimizing the cost (jump) - Given a directed graph. Check whether a graph contain a cycle or not. - Given a level K , you have to find out the sum of data of all the nodes at level K in a binary tree. -Input is given as: - ``` - (P(C()())(C()())) - P is for Parent, C is for child. - if parent has one child : (P(C()())()) - if parent has no child : (P()()) - ``` -- 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. + Input is given as: + ``` + (P(C()())(C()())) + P is for Parent, C is for child. + if parent has one child : (P(C()())()) + if parent has no child : (P()()) + ``` +- 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. 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. `` @@ -125,8 +136,8 @@ For example with 3 elements 1,2,3 there are 5 possible BST and for 1,2,3,4 there - Given an NxM (N rows and M columns) integer matrix with non-negative values (0..MAX_INT inclusive). What is the maximum sum from going top left (0, 0) to bottom right (N-1, M-1) ? The condition is that when you're at point (p, q), you can only move to either right (p, q+1) or down (p+1, q). - Mr. Kim has to deliver refrigerators to N customers. From the office, he is going to visit all the customers and then return to his home. Each location of the office, his home, and the customers is given in the form of integer coordinates (x,y) (0≤x≤100, 0≤y≤100) . The distance between two arbitrary locations (x1, y1) and (x2, y2) is computed by |x1-x2| + |y1-y2|, where |x| denotes the absolute value of x; for instance, |3|=|-3|=3. The locations of the office, his home, and the customers are all distinct. You should plan an optimal way to visit all the N customers and return to his among all the possibilities. -You are given the locations of the office, Mr. Kim’s home, and the customers; the number of the customers is in the range of 5 to 10. -Write a program that, starting at the office, finds a (the) shortest path visiting all the customers and returning to his home. Your program only have to report the distance of a (the) shortest path. + You are given the locations of the office, Mr. Kim’s home, and the customers; the number of the customers is in the range of 5 to 10. + Write a program that, starting at the office, finds a (the) shortest path visiting all the customers and returning to his home. Your program only have to report the distance of a (the) shortest path. **Constraints** @@ -169,29 +180,29 @@ Write a program that, starting at the office, finds a (the) shortest path visiti - Given a graph question. We have to find the loop in the graph if it exist and print the nodes of the loop in sorted order. - You are given an old touch smartphone numbers having dial pad and calculator app. -The goal is to type a number on dialpad. -Calculator have 1-9 and +, -, \* , /, = as operations. But as phone is old, some of the numbers and some operations can't be touched. -But you can always make a number using other numbers and operations. There could be multiple ways of making a number. You have to find minimum operation for making a number. -For ex: lets say 1,4,6,7,8,9 works and +,-,* works. -2,3,5 and / doesn't work. -If you have to type 18-> 2 operations. (Each touch is considered an operation). -If you have to type 5 -> '1+4=' that requires 4 operations. There could be other ways to make '5'. - The goal is to find minimum operations. + The goal is to type a number on dialpad. + Calculator have 1-9 and +, -, \* , /, = as operations. But as phone is old, some of the numbers and some operations can't be touched. + But you can always make a number using other numbers and operations. There could be multiple ways of making a number. You have to find minimum operation for making a number. + For ex: lets say 1,4,6,7,8,9 works and +,-,* works. + 2,3,5 and / doesn't work. + If you have to type 18-> 2 operations. (Each touch is considered an operation). + If you have to type 5 -> '1+4=' that requires 4 operations. There could be other ways to make '5'. + The goal is to find minimum operations. - There are N pots. Every pots 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 know O1 to On(overflow no. for all the pots). Crow wants some K pots to be overflow. So the task is minimum number of stones he can make K pots overflow in worst case. - Array of overflow no--. {1,...,On} - Number of pots--n - No of pots to overflow-- k + Array of overflow no--. {1,...,On} + Number of pots--n + No of pots to overflow-- k - Let say two pots are there with overflow no.s {5,58}, and crow has to overflow one pot(k=1). So crow will put 5 stones in pot with overflow no.(58), it will not overflow, then he will put in pot with overflow no.(5), hence the total no. of stones to make overflow one pot is=10. + Let say two pots are there with overflow no.s {5,58}, and crow has to overflow one pot(k=1). So crow will put 5 stones in pot with overflow no.(58), it will not overflow, then he will put in pot with overflow no.(5), hence the total no. of stones to make overflow one pot is=10. - You are given 2 convex hulls. Find all the common points that lie in the intersection of these 2 convex hulls. - There is one spaceship. X and Y co-odinate of source of spaceship and destination spaceship is given. There are N number of warmholes; each warmhole has 5 values. -First 2 values are starting co-ordinate of warmhole and after that value no. 3 and 4 represents ending co-ordinate of warmhole and last 5th value is represents cost to pass through this warmhole. Now these warmholes are bi-directional. -Now the to go from (x1,y1) to (x2,y2) is abs(x1-x2)+abs(y1-y2). -The main problem here is to find minimum distance to reach spaceship from source to destination co-ordinate using any number of warm-hole. It is ok if you wont use any warmhole. + First 2 values are starting co-ordinate of warmhole and after that value no. 3 and 4 represents ending co-ordinate of warmhole and last 5th value is represents cost to pass through this warmhole. Now these warmholes are bi-directional. + Now the to go from (x1,y1) to (x2,y2) is abs(x1-x2)+abs(y1-y2). + The main problem here is to find minimum distance to reach spaceship from source to destination co-ordinate using any number of warm-hole. It is ok if you wont use any warmhole. - 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 others.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,7 +218,7 @@ The main problem here is to find minimum distance to reach spaceship from source 5 1 - - There is a n x n matrix with only 0s & 1s. Letters are formed using 1 and 0. +- There is a n x n matrix with only 0s & 1s. Letters are formed using 1 and 0. For eg.- @@ -218,7 +229,7 @@ The main problem here is to find minimum distance to reach spaceship from source - 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. + 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. Eg. @@ -230,8 +241,142 @@ The main problem here is to find minimum distance to reach spaceship from source So we have to count the number of each letter in the matrix. + +- There is a maze that has one entrance and one exit. + Jewels are placed in passages of the maze. + You want to pick up the jewels after getting into the maze through the entrance and before getting out of it through the exit. + You want to get as many jewels as possible, but you don’t want to take the same passage you used once. + + When locations of a maze and jewels are given, + find out the greatest number of jewels you can get without taking the same passage twice, and the path taken in this case. + + ![](https://github.com/rishabh115/InterviewQuestions/blob/master/Samsung/res/jewel.jpg?raw=true) + #### Input + There can be more than one test case in the input file. The first line has T, the number of test cases. + Then the totally T test cases are provided in the following lines (T ≤ 10 ). + + In each test case, + In the first line, the size of the maze N (1 ≤ N ≤ 10) is given. The maze is N×N square-shaped. + From the second line through N lines, information of the maze is given. + “0” means a passage, “1” means a wall, and “2” means a location of a jewel. + The entrance is located on the upper-most left passage and the exit is located on the lower-most right passage. + There is no case where the path from the entrance to the exit doesn’t exist. + + #### Output + From the first line through N lines, mark the path with 3 and output it. + In N+1 line, output the greatest number of jewels that can be picked up. + Each test case must be output separately as a empty. + +- 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. + Help this company-caring man calculate the lowest expense. + + Time limit : 1 second (java : 2 seconds) + + #### Input format + + 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. + 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) + 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. + + #### Output format + + 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. + + Example of Input + + 2
+ 5
+ 0 14 4 10 20
+ 14 0 7 8 7
+ 4 5 0 7 16
+ 11 7 9 0 2
+ 18 7 17 4 0
+ 5
+ 9 9 2 9 5
+ 6 3 5 1 5
+ 1 8 3 3 3
+ 6 0 9 6 8
+ 6 6 9 4 8
+ + Example of Output + + 30
+ 18 +- 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. + Write a program to find out the minimum number moves to catch a piece. + + Time limit:1 second (java: 2 seconds) + + #### Input + 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. + 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. + 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) + + #### Output + 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 the minimum number of movements to catch a defending piece at the first line of each test case. If not moveable, output equals ‘-1’. + + +- 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. +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. + + #### Input + 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. + 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) + 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. + The coordinate of the row and column on which the bomb fall is given by being separated with a blank on the last row. + + #### Output + 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. +- Given number of pipes 1..n, Find two largest pipes of maximum length possible. +Ex: input - 1,2,3,4,6 +Output - The maximum length possible is 8. +Pipe1 - 2,6 +Pipe2 - 1,3,4 + +- 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.. + + Here is the Task :- Find the shortest of the longest distance of research center from given locations of rare-elements. + + Locations are given in the matrix cell form where 1 represents roads and 0 no road.. + Number of rare-element and their location was also given(number<=5) + and order of square matrix was less than equal to (20). + +- 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 +which has following properties: + + Each wormhole has an entry and an exit. + Each wormhole is bi-directional i.e. one can enter and exit from any of the ends. + The time to cross the wormhole is given and the space craft may or may not use the wormhole + to reach D. + The time taken to travel outside wormhole between two points (x1, y1) and (x2, y2) is given by a formula + |x1 - x2| + |y1 - y2| + + where, (x1, y1) and (x2, y2) are the co-ordinates of two points. + The co-ordinates of S and D are given and we have to find the minimum time to reach D from S. + + Note: It’s not mandatory to consider all the wormholes. + +- 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 + 1.the multiplication of point assigned to balloon on left and that of right side. + + 2.point assigned to left if no right exists + + 3.point assigned to right if no left exists. + + 4.the point assigned to itself if no other balloon exists. + + You have to output the maximum no of points possible. + + Input + + 1 2 3 4 + + Output + + 20 ---- Technical Interview Questions @@ -247,6 +392,8 @@ The main problem here is to find minimum distance to reach spaceship from source - Write a program to create circular queue? - Detect and remove loop in linked list. - Design LRU data structure. +- WAP for finding nth node from the end in the linked list. +- Explain KMP Algorithm. - Zigzag traversal between two singly linked list. - There is a N*M matrix where each row is sorted. Find the kth largest element in matrix? - Print sum of all prime numbers within a given range. @@ -256,12 +403,24 @@ The main problem here is to find minimum distance to reach spaceship from source - Given two polynomials represented by two arrays, write a function that multiplies given two polynomials. - What are the disadvantages of stack. - Write a program to find when we get stack overflow if we are using recursive functions. +- How cycle detection is different in directed and undirected graphs? +- Write a program to append a C-style string to the end of another C-style string. You were supposed to +write a function like void concat(char* a , char* b) such that after calling this function a becomes +a+b(concatenation of a and b). Assume that size of a is greater than length of a+length of b.No +library functions were to be used. Not even strlen. +- Why do we need trie data structure?Tell one another technique which does the same job as trie +with same time complexity? Then why trie is preferred over that one?(The other technique which I +told was hashing).

DBMS - What is view in DBMS? - What is Indexing? - +- 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 +- Primary indexing vs Secondary indexing vs cluster indexing, multilevel indexing. +- Sparse indexing vs dense indexing. +- Lossless decomposition vs Lossy decomposition. +- Describe join operation w.r.t databases.

Operating System @@ -285,6 +444,17 @@ The main problem here is to find minimum distance to reach spaceship from source - There is a file and 5 processes. How can you grant access so that only 2 process can write to file and 1 can read file at a time . - Stack pointer vs Frame pointer. +- Explain spooling. +- You are given a process A. The scheduler is using Priority Based Round Robin Technique for +scheduling various process. Suppose at some instant A was being run and it entered its critical +section. And there it acquired a resource X. Meanwhile another process B comes to the ready +queue. B has more priority than A. Now the preemption occurs and scheduler decides to run B and it +also wants t own resource X to complete some task. Now B won’t be able to take the resource as A +is already having it but since it has higher priority it must run before A. So is this condition a +deadlock? Explain with reasons. +- What is starvation? Out of priority based round robin scheduling and priority based scheduling , which one is more likely +to suffer from the problem of starvation? How to recover from starvation? +
Miscellaneous @@ -292,6 +462,8 @@ only 2 process can write to file and 1 can read file at a time . - Implement you own strcat() function. Dont use string header. - Difference between TCP and UDP. - What is Inline functions? +- 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. +- Balloon burst problem. - Write a program to allocate a 3D-array dynamically. - Write your own typedef operator. - What is meant by Early binding and late binding. @@ -301,9 +473,12 @@ only 2 process can write to file and 1 can read file at a time . - What is L-value and R-value reference? - State various principles of OOPS. - Define MFC COM and DCOM. +- Difference between NULL and NIL. - What is meant by Big and Small Endian? How would you know that Machine code is Big or Small Endian? - What is friend class and function in C++? - What is Virtual Function in C++? +- Explain VTABLE and VPTR? +- Difference between sizeOf(void) and sizeOf(void*). - Full form of conio. - Describe Java's garbage collection. - Explain Abstract and pure Virtual function in detail. @@ -320,7 +495,17 @@ only 2 process can write to file and 1 can read file at a time . - Explain MultiLevel inheritance. - Memory layout of C program. - What is structure padding ? +- What are memset and memcopy? - What is function pointer? - 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. - What is name mangling, and how does it work? - What does malloc(0) return? +- There are 25 horses and 1 racing track. You can conduct a race of atmost 5 horses on that track. You +need to find fastest 3 horses. What is the minimum number of races do you require? +- You are given 8 batteries and 1 torch. 4 batteries are working and 4 are dead. The torch + accommodates 2 batteries. If both the batteries are working then the torch will glow otherwise not. + What is the minimum number of times you need to switch the torch to find out 2 working batteries? +- + + +## Feel free to show your love :heart: by putting a star :star: on this project :v: . diff --git a/Samsung/res/jewel.jpg b/Samsung/res/jewel.jpg new file mode 100644 index 0000000..bada773 Binary files /dev/null and b/Samsung/res/jewel.jpg differ diff --git a/Samsung/solution/cr1.markdown b/Samsung/solution/cr1.markdown new file mode 100644 index 0000000..24efab8 --- /dev/null +++ b/Samsung/solution/cr1.markdown @@ -0,0 +1,135 @@ +```Java + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.*; + +class TestClass { + static int map[][], ans=0,n,m,r,c,l; + static boolean compat(int x,int y,int i,int j) + {if(x==i&&y==j)return true; + //System.out.println(ans+" "+x+" "+y+" "+i+" "+j+" "); + if(map[x][y]==1) + { + if((i==x-1&&j==y)||(i==x&&j==y-1)||(i==x+1&&j==y)||(i==x&&j==y+1))return true; + else return false; + } + else if(map[x][y]==2) + { + if((i==x+1&&j==y)||(i==x-1&&j==y))return true; + return false; + + } + else if(map[x][y]==3) + { + if((i==x&&j==y-1)||(i==x&&j==y+1))return true; + return false; + + } + else if(map[x][y]==4) + { + if((i==x-1&&j==y)||(i==x&&j==y+1))return true; + return false; + + } + else if(map[x][y]==5) + { + if((i==x+1&&j==y)||(i==x&&j==y+1))return true; + return false; + + } + else if(map[x][y]==6) + { + if((i==x+1&&j==y)||(i==x&&j==y-1))return true; + return false; + + } + else if(map[x][y]==7) + { + if((i==x&&j==y-1)||(i==x-1&&j==y))return true; + return false; + + } + + + + +return false; + + + } + static boolean cmap[][]; + public static void main(String args[] ) throws Exception { + Scanner s = new Scanner(System.in); + int t=s.nextInt(); + while((--t)>=0) + {n = s.nextInt(); + m =s.nextInt(); + r =s.nextInt(); + c =s.nextInt(); + l =s.nextInt(); + + +map=new int[n][m]; +cmap=new boolean[n][m]; + for (int i = 0; i =n||j<0||j>=m)return ; + if(map[i][j]==0)return ; + + if(!compat(i,j,px,py))return ; + if(cmap[i][j]){} + else ans++; + cmap[i][j]=true; + + if(map[i][j]==1) + {solve(i-1,j,i,j,len-1); + solve(i,j-1,i,j,len-1); + solve(i+1,j,i,j,len-1); + solve(i,j+1,i,j,len-1); + } + else if(map[i][j]==2) + {solve(i-1,j,i,j,len-1); + solve(i+1,j,i,j,len-1); + } + else if(map[i][j]==3) + {solve(i,j+1,i,j,len-1); + solve(i,j-1,i,j,len-1); + } + else if(map[i][j]==4) + { + + solve(i,j+1,i,j,len-1); + solve(i-1,j,i,j,len-1); + } + else if(map[i][j]==5) + { + + solve(i,j+1,i,j,len-1); + solve(i+1,j,i,j,len-1); + } + else if(map[i][j]==6) + { + + solve(i,j-1,i,j,len-1); + solve(i+1,j,i,j,len-1); + } + else if(map[i][j]==7) + { + + solve(i,j-1,i,j,len-1); + solve(i-1,j,i,j,len-1); + } + } + + +} +``` diff --git a/Thoughtworks/Readme.md b/Thoughtworks/Readme.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Thoughtworks/Readme.md @@ -0,0 +1 @@ + diff --git a/Twitter/README.md b/Twitter/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Twitter/README.md @@ -0,0 +1 @@ + diff --git a/Uber/README.md b/Uber/README.md new file mode 100644 index 0000000..a9305a5 --- /dev/null +++ b/Uber/README.md @@ -0,0 +1,170 @@ +# Uber Interview Questions +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+ +- Given a sorted array arr[] and a number x, write a function that counts the occurrences of x in arr[]. (O(Log(N))) +- A text file contains {candidateID,voterID} details of an ongoing voting. +Read this file in real time and report top 5 candidates. +Also report a fraud if a Voter tries to vote twice or try to vote more then one candidate. +Assume that the database is offline. +- Write a program to check whether Sudoku is valid or not. +- Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. +- Given an array of words, print the count of all anagrams together in sorted order (increasing order of counts). +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. +- Given a roman numeral, convert it to an integer. +- 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. +The same repeated number may be chosen from C unlimited number of times. +- Given a digit string, return all possible letter combinations that the number could represent in a T9 keypad. + ``` + Input:Digit string "23" + Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. + ``` +- Given two list of unsorted intervals V1 and V2 write 2 functions 'OR ' and 'AND' to return a new list + + OR Function (union of list ): Input V1 = (2,4) (6,8) (1,3) V2 = (7,9) (2,5) + Output = (1,5) (6,9) + + AND function : This will be intersection function and will return intersection of the lists. +- Given an unsorted array of integers, find the length of the longest consecutive elements sequence. +Your algorithm should run in O(n) complexity. +- Generate all possible matched parenthesis, given n left parenthesis and right parenthesis needs to be matched. +- There is a notepad which accepts only four operations: + 1. Character X + 2. select all + 3. copy + 4. paste + + Given n number of operations, provide the sequence of choices that gives maximum characters in the notepad. +- 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. +- 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. + + e.g. + a relies on b + + b relies on c + + then a valid sequence is [c, b, a]. +- Given a string s, partition s such that every substring of the partition is a palindrome. + Return all possible palindrome partitioning of s. +- Given a string s, return all the palindromic permutations ( without duplicates), of it. Return an empty array if no palindromic combinations can be formed. +- Given an input string and ordering string, need to return true if the ordering string is present in Input string. +- Given a sorted dictionary (array of words) of an alien language, find order of characters in the language. +- 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. +- 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: + + ``` + Ex: + Chemicals array: ['Amazon', 'Microsoft', 'Google'] + Symbols: ['I', 'Am', 'cro', 'Na', 'le', 'abc'] + + Output: + [Am]azon, Mi[cro]soft, Goog[le] + + ``` +- WAP to take one element from each of the array add it to the target sum. Print all those three-element combinations. + +- Given two numbers represented by two linked lists, write a function that returns sum list. +- 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. +- 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. + + For example, given + s = "leetcode", + dict = ["leet", "code"]. + + Return true because "leetcode" can be segmented as "leet code". +- Given an array of Ints find a maximum sum of non adjacent elements. +for ex. arr = [1,0,3,9,2] then ans would be 10 = 1 + 9 (non adjacent element) . +- 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 . +- 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. +- Given string a and b, with b containing all distinct characters, find the longest common subsequence's length. +- Given a 4\*n block, find number of different ways of filling it with 1*2 smaller blocks. Rotation of smaller blocks is allowed. +- 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. +- 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. +- 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. +- 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). +- Given a character limit and a message, split the message up into annotated chunks without cutting words as, + + For example when sending the SMS + + "Hi Sivasrinivas, your Uber is arriving now!" + + with char limit 25, + + you should get + + ["Hi Sivasrinivas,(1/3)", "your Uber is arriving(2/3)", "now!(3/3)"]. +- Write a function to tell us if a full deck of cards shuffledDeck is a single riffle of two other halves half1 and half2. +---- +Technical Interview Questions +
+Data Structures and Algorithms +- WAP to return mirror of a binary tree. +- Implement dictionary. +- Sparse vector product. Given two very large sparse vectors, + 1. find the data structure to store them + 2. calculate the product of them +- Design a HashMap in Java. Implement put, get, remove, resize methods. +- Implement LRU Cache. +- Program to check whether a given graph is Bipartite or not. +- Given a list of number, return all subsets of the list. +- Serialize & Deserialize a binary tree. +- Design a data structure that supports insert, delete, search and getRandom in constant time. +- Design a data structure that supports 3 below operations: + 1. GetNextId() : It returns the auto incremental next id. i.e 1 then 2 then 3 then 4 + 2. Acknolwdge(int i) : receives the acknowledgement of the id that was sent by GetNextId + 3. GetIdLevel() : It returns the minimum id that has not been acknowledged. +- 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. +- Given a string, determine if a permutation of a string can form a palindrome. +- Implement a timer using queue. +- Implement boggle(Find all possible words in a board of characters). +- Implement a map data structure using a binary search tree. It should have the functions Get, Set, and Size. +- Implement the substring method. +- 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. +- Given a 2D array of either '\' or '/', find out how many pieces this rectangle is divided into graphically. +For a 2X2 matrix with +``` +/\ +\/ +``` +The matrix split into 5 pieces - the diamond in middle and the four corners. Return 5 as the answer. +- 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. +- Design classes to represent the following problem and solve the questions 1,2,3 +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 +with the following details: + 1. Send user all the offers to the user + 2. Send user all eligible offers (where minCreditScore < userCreditScore < maxCreditScore) + 3. Send user all offers which satisfied 2) and where the (userOutStandingLoanAmount < maxOfferedAutoLoanAmount) +- 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. + + 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 +- Implement search in contacts list when the keyboard type is T9 (predictive text). +- 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). +- Write a function to check that a binary tree is a valid binary search tree. +- 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. +- Implement queue with two stacks. +- 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. +- WAP to find the k smallest values in a binary search tree. +- Program to find the distance between two keys in a binary tree, no parent pointers are given. +

+Miscellaneous + +- There is a primary machine and a secondary(backup machine). Write a program to sync files from primary to backup machine. +- Design an alarm system for a driverless car. +- Design an algorithm to operate elevators to pick up people on different floors of a building. +- Given a restaurant menu and a budget, output all the possible ways to use up the budget. +- How would you find the words that became obsolete in English language between 16th and 17th century? You may use a search engine. +- Design a price surge system, both at a high level and the architecture +- Design a distributed system for sorting of large files. +- Design Netflix +- Design Online Spreadsheets +- Design Twitter + + +## Feel free to show your love :heart: by putting a star :star: on this project :v: . diff --git a/Walmart Labs/README.md b/Walmart Labs/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Walmart Labs/README.md @@ -0,0 +1 @@ + diff --git a/Yatra.com/README.md b/Yatra.com/README.md index 3180748..a554f08 100644 --- a/Yatra.com/README.md +++ b/Yatra.com/README.md @@ -74,12 +74,18 @@ e.g. Grid is YYYN - Given a binary tree, Do the reverse level order traversal. +- Given coordinates of points find closest pair points distance. + - Given an array find two elements whose sum equal to zero. - Reverse the elements of stack without using another stack, queue and array. - Implement Manacher's algorithm. +- 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). + +- Perform reverse level order traversal using TreeMap(Java). + - Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree - In a binary tree, find the left facing elements with recursion and without recursion. @@ -181,7 +187,12 @@ students. How might a SQL join arise naturally in such a database? - Draw Class diagram of Training and Placement Cell of your college. --- + +## Feel free to show your love :heart: by putting a star :star: on this project :v: . + References - [Geeksforgeeks](http://www.geeksforgeeks.org/) - [Career Cup](https://www.careercup.com/) - [Glassdoor](https://www.glassdoor.co.in/index.htm) + + diff --git a/Zomato/README.md b/Zomato/README.md new file mode 100644 index 0000000..1985ea4 --- /dev/null +++ b/Zomato/README.md @@ -0,0 +1,33 @@ +# Zomato Interview Questions +* [Coding Round Questions](#coding) +* [Technical Interview Questions](#tech) + * [Data Structures and Algorithms](#dsalg) + * [DBMS](#dbms) + * [Operating System](#os) + * [Miscellaneous](#misc) +* [References](#ref) +____ +Coding round questions
+- Find total number of set bit in numbers upto n. +- Reverse the each word of the given paragraph. +- WAP to find height of BST. +- Form the maximum number from the elements of the array. +---- +Technical Interview Questions + +Data Structures and Algorithms +- Detect and remove loop in linked list. Proof of hare and tortoise algo. +- Detect if two line segments intersect each other. +- A cylinder is rolled in the form of a sheet. Given two points find out the distance between them. +- WAP to find k nearest points. +- Design LRU cache. +- Find the minimum number of switches you have to press to turn on all the bulbs. +- Delete a node with a pointer in linked list. +- Given a dictionary list possible approaches for finding whether key exists in the dictionary or not. +- Create a stack in java. +- Longest palindromic substring. +- WAP to check whether tree is symmetric or not. +- Find the sum of odd positioned nodes of a BST. + +Miscellaneous +- If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/check.java b/check.java new file mode 100644 index 0000000..52b8ec8 --- /dev/null +++ b/check.java @@ -0,0 +1,7 @@ +public class check +{ +public static void main(String args[]) +{ +System.out.println("hello world"); +} +} diff --git a/splash.png b/splash.png new file mode 100644 index 0000000..35cae09 Binary files /dev/null and b/splash.png differ diff --git a/thumbnail.png b/thumbnail.png new file mode 100644 index 0000000..4faab53 Binary files /dev/null and b/thumbnail.png differ