Google Archives

https://github.com/krishnadey30/LeetCode-Questions-CompanyWise

  1. Given a set of directories, folders and files in the format

    Input:
    A - B - C - E
    A - B - D - F 
    A - X
    D - E
    D - F
    Output:
    A - B - C - E
    	  - D - F
      -X
    D - E
      - F

2. An array of the heights of objects and an array of the heights of the contiguous storage areas were given. For an object to be placed in a certain storage column it should pass through all the previous columns. Give an arragement of the objects such that maximum number of objects could fit.

Ex- Obj heights: 3,4,1,3,5 Storage heights: 3,4,2,3,5

Ans: 3,3,-1,-1,1 (-1 indicating no object could be placed)

3. Given an array and a value k, find the number of non overlapping subarray pairs such that all the elements in the subarray have value >=k

Ex - 3,4,1,5,6 and k=3 Ans: 11

4. Consider a mountain as an isosceles right angled triangle with hypotenuse on the x-axis. Given coordinates (x,y) of the peaks of mountains, find the number of visible mountains.

The question was pretty vague and eventually it boiled down to finding the extent of each mountain i.e. interval covered by each mountain and finding the number of non overlapping intervals.

5. Given an nXm graph with source and sink. Find the total number of paths to reach from source to sink with & without blocked cells. You can only move in right and down directions.

6. Find the minimum number of cells to be blocked so that there exists no path from source to sink.

7. Find the number of "always searchable" elements given an unsorted array and choosing a random pivot at each step instead of the usual way as it happens in binary search. Ex- 3,2,1,4 Ans: 1, because 4 can be searched always. 4 is on the correct side of every number in the array whatever be the pivot

8. https://www.techiedelight.com/find-n-digit-binary-strings-without-consecutive-1s

9. https://leetcode.com/problems/split-array-largest-sum/

Last updated