Skip to content

Interview Experience 116 (Intern)

Chetan Garg edited this page Jul 23, 2018 · 2 revisions

2018

Software Developer Intern

Coding Round - 50 mins

  1. Marks: 20 Type: Function Problem

Problem Statement: Given two integer arrays p and q of sizes m and n, return the minimum value of (i + 1) * (j + 1), such that p[i] == q[j]. If no such (i, j) exist return -1.

Constraints: 1< m, n <= 100000

Marks: 40 Type: Function Problem

Problem Statement: Given a string consisting of only the characters: 'V', '/' and '', the string is considered to be in flow if the starting tip of each character touches the ending tip of the previous character.

Given the two operations you can perform are: i. Insert a new character. ii. Replace a character with another character.

return the minimum no. of operations required to make the given string in flow.

Interview Round 1 - About 50 mins

  • Let's suppose there is an ongoing cricket match. We want to stay updated about the top five batsmen (scorers) as the match proceeds. Design a suitable data structure for this purpose.

  • Given an array of integers, how do we find the permutation that is numerically the largest possible.

  • Given a number of courses offered in a university and the prerequisite courses for each course, and an array of the courses wished to be taken by a student, how do we find all the additional courses, they need to take.


Interview Round 2 - About 60 mins

  • Briefly tell about the concept of O.O.P..
  • We can achieve the same thing using C (P.O.P.), so why C++ (O.O.P.)?
  • Is C++ a pure O.O.P. Language? Why?
  • What is polymorphism? What are its types?
  • What is compile-time overloading and run-time overloading? Which of the two types, is function overloading?
  • What is an abstract class?
  • Will the following C++ code compile?

class ABC{ int a, b; ABC(){//default constructor ABC(3, 5); } ABC(int x, int y){//parameterised constructor a = x; b = y; } };

  • Write a function which returns the average of an array of integers.

Follow Up: What is overflow? How will you take care of it?

  • Design a data structure which supports all the following operation in O(1) time:

insert(int x) delete(int x) bool isAvailable(int x)

given that 0 <= x <= 9999. (You don't need to worry about repeating elements or count)

Follow Up: It should also support another operation in O(1) time: int random(), which return a random element present in the data structure (You don't need to worry about the probability of returning each present element being equal, and you can use extra space)

Clone this wiki locally