Coding Ninjas interview experience Real time questions & tips from candidates to crack your interview

Problem Setter Intern

Coding Ninjas
upvote
share-icon
3 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 5 months
Topics: Data Structures, Algorithms, Aptitude, OOPS, DBMS
Tip
Tip

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

Application process
Where: Linkedin
Eligibility: Good In DSA, Competitive Programming, Good Ranks in different Coding Platforms
Resume Tip
Resume tip

Tip 1 : Have Good Programming Profiles
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects, and experiences more.

Interview rounds

01
Round
Medium
Assignment
Duration24 hours
Interview date19 Apr 2021
Coding problem1

1. Number of islands

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.

Problem approach

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.

02
Round
Easy
Video Call
Duration60 minutes
Interview date8 May 2021
Coding problem2

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.

1. Minimum Number of Deletions and Insertions

Moderate
0/80
Asked in companies
MicrosoftPhonePeCoding Ninjas

You are given 2 non-empty strings 's1' and 's2' consisting of lowercase English alphabets only.


In one operation you can do either of the following on 's1':

(1) Remove a character from any position in 's1'.

(2) Add a character to any position in 's1'.


Find the minimum number of operations required to convert string 's1' into 's2'.


Example:
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.


Problem approach

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 ).

Try solving now

2. Minimum Number Of Operations To Reach X.

Moderate
25m average time
60% success
0/80
Asked in companies
LinkedInOYOAmerican Express

You have been given an array/list ‘ARR’ of integers consisting of ‘N’ integers. You are also given an integer ‘X’. In one operation, you can either remove the leftmost or the rightmost element and add that to the sum of removed elements so far. Your task is to return the minimum number of operations such that the sum of removed elements becomes exactly ‘X’. If it is not possible return -1.

For Example :
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.
Problem approach

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.

Try solving now
03
Round
Easy
HR Round
Duration30 minutes
Interview date11 May 2021
Coding problem1

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

1. Basic HR Questions

Tell me about yourself.

What about your coding experience?

Problem approach

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

Skill covered: Programming

What is the output of print(type("Python"))?

Choose another skill to practice
Similar interview experiences
company logo
Teaching Assistant
1 rounds | 1 problems
Interviewed by Coding Ninjas
674 views
0 comments
0 upvotes
company logo
Teaching Assistant
1 rounds | 2 problems
Interviewed by Coding Ninjas
744 views
0 comments
0 upvotes
company logo
Teaching Assistant
1 rounds | 2 problems
Interviewed by Coding Ninjas
904 views
0 comments
0 upvotes
company logo
Teaching Assistant
1 rounds | 2 problems
Interviewed by Coding Ninjas
719 views
0 comments
0 upvotes