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

SDE - 1

IBM
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 Months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : You must have a grip over Data Structures and algorithms. Your concepts must be crystal clear. Pick one coding platform and try to practice at least 7-10 coding questions everyday. I completed around 200+ questions on Leetcode, 200+ questions on Geek For Geeks and around 30-40 questions on InterviewBit.
Tip 2 : After attempting any coding problem, analyze its time and space complexity. See, if you can further optimize your solution. You can always check the editorials and compare your solution with it.
Tip 3 : Apart from coding questions keep studying concepts of Operating Systems, databases and object oriented programming. You can always refer to Geeks For Geeks articles for it. Also, Coding Ninja's Data Structures and algorithms course in C++ helped me a lot in improving my OOPS concepts specifically.

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : You do not need to have a long list of projects on your resume. One good project with proper knowledge of it will do good. Similarly, do not list down several number of skills. Few skills but roper knowledge of them are enough.
Tip 2 : Do not fake anything on your resume. The interviewer gets to know about it by asking questions. If you aren't able to answer, it leaves a negative impact.

Interview rounds

01
Round
Easy
Video Call
Duration45 Minutes
Interview date9 Jul 2022
Coding problem2

1. Minimum number of swaps required to sort an array

Easy
10m average time
90% success
0/40
Asked in companies
IBMHikeSamsung

You have been given an array 'ARR' of 'N' distinct elements.

Your task is to find the minimum no. of swaps required to sort the array.

For example:
For the given input array [4, 3, 2, 1], the minimum no. of swaps required to sort the array is 2, i.e. swap index 0 with 3 and 1 with 2 to form the sorted array [1, 2, 3, 4].
Problem approach

You have been given an array 'ARR' of 'N' distinct elements.
Your task is to find the minimum no. of swaps required to sort the array.

Try solving now

2. Evaluate Division

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

You are given an array of pairs of strings 'EQUATIONS', and an array of real numbers 'VALUES'. Each element of the 'EQUATIONS' array denotes a fraction where the first string denotes the numerator variable and the second string denotes the denominator variable, and the corresponding element in 'VALUES' denotes the value this fraction is equal to.

You are given ‘Q’ queries, and each query consists of two strings representing the numerator and the denominator of a fraction. You have to return the value of the given fraction for each query. Return -1 if the value cannot be determined.

Example :
'EQUATIONS' = { {“a”, ”s”} , {“s”, “r”} }
'VALUES' = { 1.5, 2 }
queries = { {“a”, “r” } }

For the above example (a / s) = 1.5 and (s / r) = 2 therefore (a / r) = 1.5 * 2 = 3.
Problem approach

You are given an array of pairs of strings 'EQUATIONS', and an array of real numbers 'VALUES'. Each element of the 'EQUATIONS' array denotes a fraction where the first string denotes the numerator variable and the second string denotes the denominator variable, and the corresponding element in 'VALUES' denotes the value this fraction is equal to.
You are given ‘Q’ queries, and each query consists of two strings representing the numerator and the denominator of a fraction. You have to return the value of the given fraction for each query. Return -1 if the value cannot be determined.

Try solving now
02
Round
Easy
Video Call
Duration45 minutes
Interview date9 Jul 2022
Coding problem2

1. Negative Cycle in a Directed Graph

Moderate
25m average time
75% success
0/80
Asked in company
IBM

You have been given a directed weighted graph of ‘N’ vertices labeled from 1 to 'N' and ‘M’ edges. Each edge connecting two nodes 'u' and 'v' has a weight 'w' denoting the distance between them.

Your task is to detect whether the graph contains a negative cycle or not. A negative cycle is a cycle whose edges are such that the sum of their weights is a negative value.

Example:

example

The above graph contains a cycle ( 1 -> 2 -> 3 -> 1 ) and the sum of weights of edges is -1 (1 - 4 + 2 = -1) which is negative. Hence the graph contains a negative cycle.

Note:

It's guaranteed that the graph doesn't contain self-loops and multiple edges.
Problem approach

You have been given a directed weighted graph of ‘N’ vertices labeled from 1 to 'N' and ‘M’ edges. Each edge connecting two nodes 'u' and 'v' has a weight 'w' denoting the distance between them.
Your task is to detect whether the graph contains a negative cycle or not. A negative cycle is a cycle whose edges are such that the sum of their weights is a negative value.

Try solving now

2. OOPS based Questions

Difference between Constructor and Method?

Problem approach

Constructors :
1) A Constructor is a block of code that initializes a newly created object.
2) A Constructor can be used to initialize an object.
3) A Constructor is invoked implicitly by the system
4) A Constructor is invoked when a object is created using the keyword new.
5) A Constructor doesn’t have a return type.
6) A Constructor’s name must be same as the name of the class.
7) A Constructor cannot be inherited by subclasses.


Method :
1) A Method is a collection of statements which returns a value upon its execution.
2) A Method consists of Java/C++ code to be executed.
3) A Method is invoked by the programmer.
4) A Method is invoked through method calls.
5) A Method must have a return type.
6) A Method’s name can be anything.
7) A Method can be inherited by subclasses.

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 recursion?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
2 rounds | 2 problems
Interviewed by IBM
4202 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by IBM
1745 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by IBM
2207 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by IBM
838 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
114579 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
57825 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
34961 views
7 comments
0 upvotes