The interview was conducted on zoom and codesignal was used to write working codes for the given problems.
Round 1: Three programming questions were asked in this round (Increasing order of difficulty) :
- First non repeating character in a very large string with only one traversal of the string.
- https://www.geeksforgeeks.org/dsa/sliding-window-maximum-maximum-of-all-subarrays-of-size-k/ In this problem a O(n) solution was expected.
- A dictionary of words is given. Any word is called valid, if it belongs to the dictionary. A string is given. You need to find all partitions of string such that each partition is a valid word. For eg. let the given dictionary be { man, ice, cream. go, icecream, mango } and string given to you is mangoicecream, then all the valid breakdowns are :
- man go ice cream
- man go icecream
- mango ice cream
- mango icecream
- https://www.geeksforgeeks.org/dsa/maximum-profit-by-buying-and-selling-a-share-at-most-twice/
- You are given a file of size 100 GB containing unsigned 64 bit integers. You have to write a program to sort these integers and copy it in a different file. However, usable RAM is only 2 GB. I told a approach based on merging k sorted arrays and using intermediate files. The interviewer was satisfied with the approach.
- Given a string containing only B and W's (Black and white balls) you need to bring all white balls to the start of the string. eg if the string is "BWWB" the output should be "WWBB". The only allowed operation is swaping of elements. You cannot overwrite any of the characters. Also, expected time complexity was O(n) and expected space complexity was O(1). I gave a two pointer based approach. I was asked to code the solution and also generate test cases for the same.