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

Software Engineer

IBM
upvote
share-icon
3 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.

Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.

Tip 3 : Do at least 2 good projects and you must know every bit of them.


 

Application process
Where: Campus
Eligibility: 7 CGPA and Above, No active backlog, 2022 batch
Resume Tip
Resume tip

Tip 1 : Have at least 2 good projects explained in short with all important points covered.

Tip 2 : Every skill must be mentioned.

Tip 3 : Focus on skills, projects and experiences more.


 

Interview rounds

01
Round
Easy
Online Coding Test
Duration85 minutes
Interview date6 Mar 2022
Coding problem3

This online coding round was conducted on Hackerrank.
It consisted of 10 MCQ questions with 20 minutes time and 3 coding questions with 15 + 20 + 30 minutes time.

1. Maximum Units on a Truck

Easy
15m average time
85% success
0/40
Asked in companies
WalmartAmazonIndiaMart

Ninja is assigned a task to deliver some boxes which contain different units having different weights. With the help of his truck, he will earn money on the basis of the number of units of boxes he will deliver by his truck. Ninja truck has some capacity on the number of boxes he can put on his truck.

So your task is to find a way so that ninja will choose boxes in a way that units will be maximum and he would be able to get more money you will be provided with an array of ‘BOX’, where BOX[i] = [countofBoxes, unitsperBox].

CountofBoxes represents the number of boxes of the same type i.e containing the units of the same value.

UnitsperBox represents the number of units in the box or we simply say that unit value.

And an integer ‘K’ denoting the limit of boxes on the truck.

Problem approach

It's pretty straight forward.

Step 1 : Just sort the 2d array on the basis of the 1st index

Step 2 : Keep track of our truck size and compute the answer.

 

static bool comp(vector& a, vector& b){
	return a[1] > b[1];
}

int maximumUnits(vector>& arr, int x) {
	sort(arr.begin(), arr.end(), comp);
	int ans = 0, n = arr.size();
	for(int i=0;i<n; i++)
	{
		if(x - arr[i][0] < 0){
			int left_size = x;
			ans += x * arr[i][1];
			return ans;
		}
		else
		{
			ans += (arr[i][0] * arr[i][1]);
			x -= arr[i][0];
		}
	}
	return ans;
}
Try solving now

2. Best Time to Buy and Sell Stock with Transaction Fee

Moderate
20m average time
80% success
0/80
Asked in companies
FacebookAmazonIBM

You are given an array 'prices' of size 'n', denoting the price of stocks on 'n' days.


Rahul can buy one stock at a time, and he must sell it before buying stock on another day.


The entire transaction of selling and buying the stock requires some transaction fee, given as 'fee'.


Find the maximum profit Rahul can achieve by trading on the stocks.


Example :
Input: 'prices' =  [1, 2, 3] and 'fee' = 1

Output: 1

Explanation: We can generate the maximum profit of 1 by buying the stock on the first day for price = 1 and then selling it on the third day for price = 3.

The profit will be: 3 - 1 - 1(transaction fee) = 1
Problem approach

This is a classic DP problem.
Step1 : Traverse the whole array with the difference of each day.
Step2 : Check the profit by subtracting the price of each day including transaction fee.
Step3 : Trace the maximum profit and store the diff_days on which we are getting the maximum profit.
Step4 : Repeat the above steps until the loop terminates.

Try solving now

3. Word Break

Moderate
15m average time
85% success
0/80
Asked in companies
MicrosoftFacebookApple

You are given a list of “N” strings A. Your task is to check whether you can form a given target string using a combination of one or more strings of A.

Note :
You can use any string of A multiple times.
Examples :
A =[“coding”, ”ninjas”, “is”, “awesome”]  target = “codingninjas”
Ans = true as we use “coding” and “ninjas” to form “codingninjas”
Problem approach

Step1 : (Recursive) For the string s, make a cut at each index and check if the substring 0 to cut is present in the dictionary
If it is then make the call to check for the remaining string

 

Step2 : (Memoise ) Use dp to store answer for current string

 

unordered_set dict;
unordered_map dp;
bool wordBreak_(string &s)
{
	if (dp.find(s) != dp.end())
		return dp[s];

	// check if current string itself is in the dictionary
	if (dict.find(s) != dict.end())
		return dp[s] = true;

	for (int i = 1; i < s.size(); i++)
	{
		// check substring from 1 to i of current string is in the dictionary
		if (dict.find(s.substr(0, i)) != dict.end())
		{
			string remStr = s.substr(i);
			// if the substring is present in dictionary, check for the remaining string
			if (wordBreak_(remStr))
				return dp[s] = true;
		}
	}

	return dp[s] = false;
}

bool wordBreak(string &s, vector &wordDict)
{
	// put all words into a hashset, to make find operation O(1)
	for (string &str : wordDict)
		dict.insert(str);

	return wordBreak_(s);
}
Try solving now
02
Round
Easy
Video Call
Duration60 minutes
Interview date13 Mar 2022
Coding problem3

3 coding problems related to Linked Lists of Easy to Medium level of difficulty were asked in this round

1. Add Two Numbers As Linked Lists

Moderate
20m average time
80% success
0/80
Asked in companies
MicrosoftOracleSAP Labs

You are given two non-negative numbers 'num1' and 'num2' represented in the form of linked lists.


The digits in the linked lists are stored in reverse order, i.e. starting from least significant digit (LSD) to the most significant digit (MSD), and each of their nodes contains a single digit.


Calculate the sum of the two numbers and return the head of the sum list.


Example :
Input:
'num1' : 1 -> 2 -> 3 -> NULL
'num2' : 4 -> 5 -> 6 -> NULL

Output: 5 -> 7 -> 9 -> NULL

Explanation: 'num1' represents the number 321 and 'num2' represents 654. Their sum is 975.


Try solving now

2. Merge Sort Linked List

Moderate
10m average time
90% success
0/80
Asked in companies
AdobeGoogleSamsung R&D Institute

You are given a Singly Linked List of integers. Sort the Linked List using merge sort.

Merge Sort is a Divide and Conquer algorithm. It divides the input into two halves, calls itself for the two halves, and then merges the two sorted halves. The merge() function is used for merging two halves. The merge(arr, L, M, R) is a key process that assumes that arr[L..M] and arr[M + 1...R] are sorted and merges the two sorted subarrays into one.

Try solving now

3. Reverse A Doubly Linked List

Easy
15m average time
85% success
0/40
Asked in companies
WalmartIBMGoldman Sachs

You are given a doubly-linked list of size 'N', consisting of positive integers. Now your task is to reverse it and return the head of the modified list.


Note:
A doubly linked list is a kind of linked list that is bidirectional, meaning it can be traversed in both forward and backward directions.

Example:

Input: 
4
4 3 2 1

This means you have been given doubly linked list of size 4 = 4 <-> 3 <-> 2 <-> 1.

Output: 
1 2 3 4

This means after reversing the doubly linked list it becomes 1 <-> 2 <-> 3 <-> 4.
Try solving now
03
Round
Easy
HR Round
Duration15 minutes
Interview date14 Mar 2022
Coding problem1

This was a typical HR round with some standard Behavioral questions.

1. Basic HR Question

Why should we hire you?

Problem approach

Tip 1 : The cross-questioning can go intense sometimes, think before you speak.


Tip 2 : Be open-minded and answer whatever you are thinking in these rounds, I feel it is important to have an opinion.

 

Tip 3 : Since everybody in the interview panel is from a tech background, here too you can expect some technical questions. No coding in most of the cases but some discussions over the design can surely happen.

Here's your problem of the day

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

Skill covered: Programming

Which SQL keyword removes duplicate records from a result set?

Choose another skill to practice
Similar interview experiences
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by IBM
3939 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 3 problems
Interviewed by IBM
2649 views
0 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by IBM
2560 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by IBM
438 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Engineer
3 rounds | 5 problems
Interviewed by Mindtree
11082 views
7 comments
0 upvotes
company logo
Software Engineer
3 rounds | 7 problems
Interviewed by Optum
7001 views
1 comments
0 upvotes
company logo
Software Engineer
5 rounds | 5 problems
Interviewed by Microsoft
8503 views
1 comments
0 upvotes