Tip 1 : Must do Previously asked Interviews as well as Online Test Questions.
Tip 2 : Must have good knowledge of DSA
Tip 3 : Have Good Coding Profiles
Tip 1 : Have Good Programming Profiles
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects, and experiences more.
Given a 2D binary matrix of ‘m’ rows and ‘n’ columns initially containing all ‘0’s. The given matrix represents a map where ‘0’s represents water and 1’s represents the land.
You have to perform X operations wherein each operation, you are given a location[i] = (ri, ci) the position at which you should add a land i.e ‘1’.
You need to find the count of islands after performing each of those X operations.
An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume that the matrix is completely surrounded by water.
1. Frame a complete problem statement with examples, constraints on the inputs, test case format for the input/output, and including sample test cases.
2. Writing all the possible approaches from brute to optimal.
3. Write the solution code for all the approaches in either Java, C++, or Python.
Tip 1 : Make sure about plagiarism. Write your own code and approach. Don’t copy from here and there.
Tip 2 : Write all the Possible Approaches with explanation and edge cases.
Tip 3 : Write the Hints for each possible solution.
This round was held in the evening at 4 pm on Google Meet. The interview revolved around problem solving and optimization. I was all the possible approaches and Time/Space Complexity for the problems asked.
Input: 's1' = "abcd", 's2' = "anc"
Output: 3
Explanation:
Here, 's1' = "abcd", 's2' = "anc".
In one operation remove 's1[3]', after this operation 's1' becomes "abc".
In the second operation remove 's1[1]', after this operation 's1' becomes "ac".
In the third operation add 'n' in 's1[1]', after this operation 's1' becomes "anc".
Hence, the minimum operations required will be 3. It can be shown that there's no way to convert s1 into s2 in less than 3 moves.
str1 and str2 be the given strings.
m and n be their lengths respectively.
len be the length of the longest common subsequence of str1 and str2
minimum number of deletions minDel = m – len (as we only need to delete from str1 because we are reducing it to str2)
minimum number of Insertions minInsert = n – len (as we are inserting x in str1 , x is a number of characters in str2 which are not taking part in the string which is longest common subsequence ).
Let’s say you have an array/list [1, 3, 5, 3] and ‘X’ is 7.
We can first remove the rightmost element i.e. 3. The array becomes [1,3,5]. In the next step, we can remove the leftmost element i.e 1. The array becomes [3,5] and the sum of removed elements so far becomes 4. In the next step, we can remove the leftmost element i.e 3. The array becomes [5] and the sum of removed elements so far is 7. We have reached our target X i.e 7. Therefore the minimum number of operations to reach ‘X’ is 3.
Step 0: Get positive target value (step to get negative target is the same as to get positive value due to symmetry).
Step 1: Find the smallest step that the summation from 1 to step just exceeds or equalstarget.
Step 2: Find the difference between sum and target. The goal is to get rid of the difference to reach target. For ith move, if we switch the right move to the left, the change in summation will be 2*i less. Now the difference between sum and target has to be an even number in order for the math to check out.
Step 2.1: If the difference value is even, we can return the current step.
Step 2.2: If the difference value is odd, we need to increase the step until the difference is even (at most 2 more steps needed).
Eg:
target = 5
Step 0: target = 5.
Step 1: sum = 1 + 2 + 3 = 6 > 5, step = 3.
Step 2: Difference = 6 - 5 = 1. Since the difference is an odd value, we will not reach the target by switching any right move to the left. So we increase our step.
Step 2.2: We need to increase step by 2 to get an even difference (i.e. 1 + 2 + 3 + 4 + 5 = 15, now step = 5, difference = 15 - 5 = 10). Now that we have an even difference, we can simply switch any move to the left (i.e. change + to -) as long as the summation of the changed value equals to half of the difference. We can switch 1 and 4 or 2 and 3 or 5.
This round was taken by the Project Manager and was kind of a Noneliminatory round as this round was to tell about the project, responsibilities, compensation and Duration of internship
Tell me about yourself.
What about your coding experience?
Tip 1 : Have Information regarding Company and the project
Tip 2 : Prepare a Good Intro
Tip 3 : Listen well before responding to questions.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is the output of print(type("Python"))?