Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
IBM interview experience Real time questions & tips from candidates to crack your interview

Associate Software Engineer

IBM
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Journey
When I joined college, I was unaware of this Data Structure and Algorithm, which made my journey to getting an internship way more complicated. From that point, I started doing questions on leetcode and code studio.
Application story
This company visited to my campus for the selection they first took a test then allow us to come for the interview.
Why selected/rejected for the role?
I was rejected because I have a good history of content preparation and i do not have a decent rank in leetcode and code forces. ,
Preparation
Duration: 3 Months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Practice from Leetcode, solve Leetcode medium level problems.
Tip 2 : Brush up computer fundamentals from subjects like OS, DBMS and CN.
Tip 3 : Have a good project or good internship experience and have in-depth knowledge regarding what you have done.

Application process
Where: Campus
Eligibility: No criteria
Resume Tip
Resume tip

Tip 1 : Have some projects on resume.
Tip 2 : Do not put false things on resume

Interview rounds

01
Round
Easy
Video Call
Duration60 Minutes
Interview date5 Jan 2023
Coding problem2

1. Search In Rotated Sorted Array

Moderate
30m average time
65% success
0/80
Asked in companies
Tata 1mgWalmartDelhivery

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array consisting of distinct integers and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4, 5] and if he rotates it by 2, then the array becomes: [4, 5, 1, 2, 3].

After rotating a sorted array, Aahad needs to answer Q queries asked by Harshit, each of them is described by one integer Q[i]. which Harshit wanted him to search in the array. For each query, if he found it, he had to shout the index of the number, otherwise, he had to shout -1.

For each query, you have to complete the given method where 'key' denotes Q[i]. If the key exists in the array, return the index of the 'key', otherwise, return -1.

Note:

Can you solve each query in O(logN) ?
Problem approach

"Search in Rotated Sorted Array" is a problem that involves finding the index of a target value in a rotated sorted array. The input array is sorted in ascending order and then rotated by some unknown number of positions to the right or left. The task is to find the index of the target value in the array, or return -1 if the target value is not found.

Try solving now

2. Symmetric Tree

Easy
20m average time
82% success
0/40
Asked in companies
OLX GroupCIS - Cyber InfrastructureIBM

You are given a binary tree, where the data present in each node is an integer. You have to find whether the given tree is symmetric or not.

Symmetric tree is a binary tree, whose mirror image is exactly the same as the original tree.

For Example:

sym_tree

Problem approach

Tree symmetry, also known as tree isomorphism or tree symmetry, refers to the property of two trees having the same structure or shape, even if their node values may be different. In other words, two trees are considered symmetric if they can be obtained from each other by swapping their left and right subtrees, or by reflecting them along their root node.

Try solving now
02
Round
Hard
Video Call
Duration60 Minutes
Interview date5 Jan 2023
Coding problem2

1. Colorful Knapsack

Hard
45m average time
0/120
Asked in companies
AdobeSamsungGoogle

You are given 'N' stones labeled from 1 to 'N'. The 'i-th' stone has the weight W[i]. There are 'M' colors labeled by integers from 1 to 'M'. The 'i-th' stone has the color C[i] which is an integer between 1 to 'M', both inclusive.

You have been required to fill a Knapsack with these stones. The Knapsack can hold a total weight of 'X'.

You are required to select exactly 'M' stones; one of each color. The sum of the weights of the stones must not exceed 'X'. Since you paid a premium for a Knapsack with capacity 'X', you are required to fill the Knapsack as much as possible.

Write a program to calculate the best way to fill the Knapsack - that is, the unused capacity should be minimized.

Problem approach

The "Colourful Knapsack Problem" is a variation of the classical "Knapsack Problem", which is a combinatorial optimization problem. In the Colourful Knapsack Problem, the items that can be selected for inclusion in the knapsack have colors associated with them, and the objective is to maximize the total value of the items in the knapsack subject to the constraint of the knapsack's capacity, while also ensuring that no two items of the same color are selected.

Try solving now

2. Puzzle

Given a building with k floors and m identical eggs, what is the minimum number of trials required to determine the highest floor from which an egg can be dropped without breaking?

Assumptions:

The eggs are identical and have the same properties.
If an egg breaks when dropped from a certain floor, it will also break when dropped from any higher floor.
If an egg does not break when dropped from a certain floor, it will not break when dropped from any lower floor.
The goal is to minimize the number of trials required to determine the highest floor with the given number of eggs.

Problem approach

The Egg Dropping Puzzle can be solved using dynamic programming. The key idea is to consider all possible dropping strategies and choose the one that minimizes the number of trials required.

Let's define a 2D array dp[i][j], where dp[i][j] represents the minimum number of trials required to determine the highest floor with i floors and j eggs.

We can start with a base case:

If there is only one floor, then we need to drop the egg from that floor, and it will either break or not break. So dp[1][j] = 1 for all j (since we need at least one trial to determine the result).
Then we can use the following recurrence relation to fill in the rest of the array dp[i][j]:

For each floor i from 2 to k, and each number of eggs j from 1 to m, we can consider dropping the egg from each floor k one by one and choose the strategy that minimizes the number of trials.
For each floor k, we have two possibilities:
If the egg breaks when dropped from floor k, we need to continue with j-1 eggs and search in the lower floors (1 to k-1). So we need dp[k-1][j-1] trials.
If the egg does not break when dropped from floor k, we need to continue with j eggs and search in the upper floors (k+1 to i). So we need dp[i-k][j] trials.
We need to consider the worst case (maximum number of trials) among these two possibilities, and add 1 to account for the current trial from floor k.
Therefore, the recurrence relation can be defined as: dp[i][j] = min(max(dp[k-1][j-1], dp[i-k][j]) + 1) for k in range(1, i).
Finally, the minimum number of trials required to determine the highest floor with m eggs can be found at dp[k][m], where k is the smallest value such that dp[k][m] >= i.

This dynamic programming approach has a time complexity of O(k^2 * m), as we need to fill in a 2D array of size k x m. There are also optimized solutions using binary search and other techniques to reduce the time complexity further.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Suppose list1 is [2, 133, 12, 12], what is max(list1) in Python?

Choose another skill to practice
Start a Discussion
Similar interview experiences
company logo
Associate Software Engineer
3 rounds | 11 problems
Interviewed by IBM
2069 views
0 comments
0 upvotes
company logo
Associate Software Engineer
4 rounds | 4 problems
Interviewed by IBM
1540 views
0 comments
0 upvotes
company logo
Staff Engineer
3 rounds | 4 problems
Interviewed by IBM
3848 views
0 comments
0 upvotes
company logo
MEAN Stack Developer
4 rounds | 6 problems
Interviewed by IBM
214 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Associate Software Engineer
3 rounds | 10 problems
Interviewed by Amdocs
1888 views
0 comments
0 upvotes
company logo
Associate Software Engineer
3 rounds | 4 problems
Interviewed by Amdocs
1390 views
0 comments
0 upvotes
company logo
Associate Software Engineer
3 rounds | 5 problems
Interviewed by Optum
1329 views
0 comments
0 upvotes