0 like 0 dislike
988 views
| 988 views

0 like 0 dislike
Online Coding Round: There were three coding questions and MCQs. Each section had a fixed allocated time. MCQs were based on general problem-solving skills and CS fundamentals.

Coding Questions:

Two players A and B play a stone game on the positive x-axis, the stone is initial at point 0 and you are given a point N. On each move, the player can move the stone by i2 (i > 0) steps towards point N. The player wins if he can move the stone to point N. You need to output which player will win. (Note: stone can never move beyond point N)

Example: Input: 5 Output: B Explanation: Player A can either move the stone by 1(1*1) or 4(2*2). No matter which move player A chooses, Player B can always choose a move to reach 5 and win.

Given an array of N numbers, you need to output the maximum value V among all the subarrays where value V for a subarray A[L..R] is defined as sum(A[L&hellip;R])*MAX(A[L&hellip;R]) 1 <= L  <= R <= N.

Constraints: 1 <= A[i] <= 1e9, 1 <= N <= 1e5

Example: Input: 1 -1 2 3 -4 Output: 15 Explanation: The subarray which gives maximum value V is A[3..4] = {2,3}, V = (2+3)*MAX(2,3) = 5*3 = 15

There was one more question which I don&rsquo;t remember.

I was able to solve most of the MCQs and one coding question partially.

After 10 days I got a call for my first technical interview.

Round 1(Technical Interview): Duration: 1hr

The interview was conducted on the hackerrank codepair platform. The interview asked me to introduce myself as well as share my internship project details. Then he asked me some follow-up questions about my internship project for about 5 minutes.

Then he moved onto questions related to CS fundamentals:

Compiler phases

How the program is stored in memory? (https://www.geeksforgeeks.org/memory-layout-of-c-program/)

If my PC has 8 GB of RAM and I open a file of size 50 GB in an editor. What are the possible outcomes?

DSA:

Implement a random function that has the following requirements:

a. Random number generated must be completely unpredictable

b. Performance should be good

I gave him a solution based on using the current timestamp and multiplying it with a prime number to generate the random number. He said that&rsquo;s a great start but the performance of your function would be slow as the time function you will be using will need to hit the clock every time to get the current time. So, he told me to optimize my solution. I kept sharing my thought process but was not able to come up with anything that works. After a few minutes, the interviewer moved on to the next question.

Given an array of distinct elements, you can choose any subset from the array and reorder them. You can place following operators between them: +, -, *, /, (, ) and evaluate the value of the expression. Your task is to find the minimum positive number which cannot be formed using the array elements. You can use the elements of an array only once for an expression.

Example: Input: [1, 2] Output: 4 Explanation: 1 and 2 are already present in the array. You can make 3 by adding 1 and 2 i.e. 3 = 1+2 There no possible way to make 4.

I was only able to tell the brute force approach and time complexity for this problem. He asked me to optimize it. I shared some ideas and made some analogy with the subset sum problem, but in the end, I was unable to solve the problem.

Verdict: Rejected

All the best!!
by Expert (30,360 points)