Google | L4 | India | July 2021 | Reject
Anonymous User
1109

Screening 1 - 2 LC tagged questions, was quite sometime back. forgot the exact questions

Coding-1
Q1. Find total count of Increasing sequence of triplets such that if first element is a, sequence should look like - a, 2a, 4a in a given array. example.

1 2 3 5 4 6 7 8
Ans = 2 ->  {1 2 4, 2 4 8}

Q2. Sort the given array such that all odd elements are towards left and all even towards right

Coding-2
Q1. Given a continuous stream of coordinates (x,y) find out if the latest addition will form a square or not.
Eg.

add(0,0) - false
add(0,1) - false
add(1,0) - false
add(1,1) - true
add(2,0) - falseand so on

Coding-3
Design a DS that should support below operations -

Insert - inserts an element
GetRandom - fetches a random element from all the elements present
Delete - deletes an element
Insert should not result in addition of duplicate elements 

I was not able to come up with optimal solution for even one of the rounds.

first round, q1, I did a N^3

second round, was not even able to code a brute force. got lost in between the implementation

third round, expectation was all the ops should be O(1), which I actually understood later in the discussion but by the time I figured out how to do in O(1) time was up

Comments (9)