# Computer scientist Interview Questions

computer scientist interview questions shared by candidates

## Top Interview Questions

1. Given an empty BST consist of n nodes and and an array consist of n numbers. The n nodes in a BST have been already arranged in some fashion(i.e. the BST is not empty), and none of the nodes in BST are having any data, that means we have to pick the n numbers from the given array and have to fill in the given BST. We have to make sure that the structure of the BST doesn't change. That means all the left subtree and right subtree at any given node should not change at all. 2. We have a function which returns a value among {1, 0, -1}. When the function returns -1 that means we have to terminate. we have to keep on calling this function and till we get -1. this means we will get series of 1's and 0's which we have to treat like bit pattern and has to check whether the given number is divisible by 3 or not. for e.g. the function call returns the below output. 101-1=> 101=> it's a 5 which is not divisible by 3. I have answered the second question saying that we can keep storing the 1's and 0's in a vector and the moment we hit -1, we will reverse iterate the vector and can get the integer number out of the bit stream and can see whether %3 is zero or not. he told me to optimize the program in terms of space and time complexity. I told we can compress the bit stream in such a way so that when we have continuous 1's and 0's can be replaced by only single 1's and 0's. He was not satisfied with the answer. Keep dividing while storing stream e.g - 10101-1 will be like 1 -> 1 0 -> 10 1 -> 101(5) divided and remain 10 0 -> 100 (4) divided and remain 1 1 -> 11(3) divided and remain 0 For Question1 : Traverse BST in inorder store into node array. Sort integer array given. Now iterate both array simultaneously & update node value with the value at same index in integer array. Show more responses |

Desgin a search system for a document search. |

Find an element from a rotated sorted array. |

First face to face round went OK. The interviewer asked about a matrix with dynamic programming algorithm and psuedo code for it. Also asked about explaining basics of technologies mentioned in the resume. I think I did justice with explaining what I knew, and from his expressions, I could not understand whether he was satisfied or not interested to listen :). No cross questions, not asking for details, just kept writing the feedback on his computer after asking. Second face to face round had two questions. One was algorithm for a tree traversal problem and proper code for it along with corner cases. Second question was a low level design problem. |

Programming Question: Maximum Product Sub array of size k (Better time complexity solution expected) Interview questions: Sort an infinite array, String rotated by k times, OOPs concepts(Polymorphism,Encapsulation), Next smallest palindrome greater than given no. |

Distance of a point from a line. |

Give an array of integers, replace ith element by following maxmium number. For eg - 2 4 8 7 6 3 2 should be replaced by max num - 8 4 should be replaced by max num - 8 8 should be replaced by max num - 7 7 should be replaced by max num - 6 6 should be replaced by max num - 3 Easy question, start iterating from end , maintain max and keep swaping ith number with max. |

Reverse a Linked list |

Given an array of whole numbers. You have to push all the zeroes towards left and positions of positive numbers should not change.(in constant memory and single traversal of array) |

Puzzle: There are 8 balls. 7 of them have equal weights, while one is heavy. Find out the heavy ball in minimum number of measuring operations. |

**1**–

**10**of

**53**Interview Questions

## See Interview Questions for Similar Jobs

- Software Engineer
- Software Developer
- Senior Software Engineer
- Member of Technical Staff
- Intern
- Software Development Engineer
- Software Development Engineer II
- Data Scientist
- Senior Software Development Engineer
- Lead Software Engineer
- Business Analyst
- Engineering Manager
- Member of Technical Staff II
- Senior Member of Technical Staff
- Associate Software Engineer
- Consultant
- Senior Consultant
- Manager