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

SDE - 1

Curefit
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 Months
Topics: C, C++, Java Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming, Operating System, Networking
Tip
Tip

Tip 1 : Must do Previously asked Interviews Questions.
Tip 2 : Prepare OS, DBMS, OOPs, Computer Networks well.
Tip 3 : Prepare well for one project mentioned in the resume, the interviewer may ask any question related to the project, especially about the networking part of the project.

Application process
Where: Referral
Eligibility: None
Resume Tip
Resume tip

Tip 1 : Practice atleast 200+ questions from leetcode.
Tip 2 : Have at least one project in the resume.
Tip 2 : Must mention every skill and certificate in the resume.
Tip 3 : Must have known every strong and intermediate skill mentioned in resume.

Interview rounds

01
Round
Medium
Online Coding Test
Duration60 Minutes
Interview date1 Apr 2022
Coding problem2

This was an online test on the hackerrank platform. The test consists of 2 coding questions to be solved in 60 mins.

1. 3Sum

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

You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.

An array is said to have a triplet {ARR[i], ARR[j], ARR[k]} with sum = 'K' if there exists three indices i, j and k such that i!=j, j!=k and i!=j and ARR[i] + ARR[j] + ARR[k] = 'K'.

Note:
1. You can return the list of values in any order. For example, if a valid triplet is {1, 2, -3}, then {2, -3, 1}, {-3, 2, 1} etc is also valid triplet. Also, the ordering of different triplets can be random i.e if there are more than one valid triplets, you can return them in any order.
2. The elements in the array need not be distinct.
3. If no such triplet is present in the array, then return an empty list, and the output printed for such a test case will be "-1".
Problem approach

class Solution {
public:
vector threeSum(vector& nums) {
int n = nums.size();
vector ans;
int lp, rp, rq;
sort(nums.begin(), nums.end());
for(int i = 0; i < (n -2); ++i){
if(i && nums[i] == nums[i-1]){
continue;
}
rq = -nums[i];
lp = i + 1;
rp = n - 1;
while(lp < rp){
if(nums[lp] + nums[rp] == rq){
vector v(3);
v[0] = nums[i]; v[1] = nums[lp]; v[2] = nums[rp];
ans.push_back(v);
lp++; rp--;
while(lp < rp && nums[lp] == nums[lp - 1]){
lp++;
}
while(rp > lp && nums[rp] == nums[rp + 1]){
rp--;
}
}
else if(nums[lp] + nums[rp] > rq){
rp--;
}
else{
lp++;
}
}
}
return ans;
}
};

Try solving now

2. Valid Parentheses

Easy
10m average time
80% success
0/40
Asked in companies
Expedia GroupInfosysSamsung

You're given a string 'S' consisting of "{", "}", "(", ")", "[" and "]" .


Return true if the given string 'S' is balanced, else return false.


For example:
'S' = "{}()".

There is always an opening brace before a closing brace i.e. '{' before '}', '(' before ').
So the 'S' is Balanced.
Problem approach

public class Solution {
public bool IsValid(string s) {
Dictionary brackets = new Dictionary();
brackets.Add(')', '(');
brackets.Add('}', '{');
brackets.Add(']', '[');

Stack stack = new Stack();

for(int i = 0; i < s.Length; i++)
{
if(!brackets.ContainsKey(s[i]))
{
stack.Push(s[i]);
}
else
{
char topStack = stack.Count != 0 ? stack.Pop() : 'a';

if(topStack != brackets[s[i]])
{
return false;
}
}
}
return stack.Count == 0;
}
}

Try solving now
02
Round
Medium
Video Call
Duration60 Minutes
Interview date12 Apr 2022
Coding problem2

This was 1st technical round taken by the software engineer at curefit. Interviewer was very friendly, he started with his introduction and then asked me to introduce myself.

He asked about my project work in detail
What are OOPs concepts and its pillar
Is java support multiple inheritance or not
what are acid properties
Write a SQL query to find the 2nd largest salary from employee table

1. Add binary strings

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

You have been given two binary strings ‘A’ and ‘B’. Your task is to find the sum of both strings in the form of a binary string.

Binary strings are the representation of integers in the binary form. For example, the binary strings of 9 and 16 are “1001” and “10000” respectively.

Problem approach

class Solution {
public:
string addBinary(string a, string b) {
reverse(a.begin(), a.end()); //Reversing both strings (if you get this, then you got the code very well)
reverse(b.begin(), b.end());

if(a.size()>b.size()){ //These two conditions are for making both strings equal sized by adding '0' to smaller string
for(int i=b.size(); i b.push_back('0');
}
}
else if(a.size() for(int i=a.size(); i a.push_back('0');
}
}

string res; //Result string
char carry='0'; //Carry
for(int i=0; i if(a[i]=='1'&&b[i]=='1'){
res.push_back(carry);
carry='1';
}
else if((a[i]=='1' || b[i]=='1')){
if(carry=='1') res.push_back('0');
else res.push_back('1');
}
else{
res.push_back(carry);
if(carry=='1') carry='0';
}
}
if(carry=='1') res.push_back('1'); //if carry is present after looping, add it at the end (remember, we first reversed strings. So everything we need to add to the front, we will push back)

reverse(res.begin(), res.end()); //Reverse again to get the final string
return res; 
}
};

Try solving now

2. Merge Intervals

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

You are given N number of intervals, where each interval contains two integers denoting the start time and the end time for the interval.

The task is to merge all the overlapping intervals and return the list of merged intervals sorted by increasing order of their start time.

Two intervals [A,B] and [C,D] are said to be overlapping with each other if there is at least one integer that is covered by both of them.

For example:

For the given 5 intervals - [1, 4], [3, 5], [6, 8], [10, 12], [8, 9].

Since intervals [1, 4] and [3, 5] overlap with each other, we will merge them into a single interval as [1, 5].

Similarly, [6, 8] and [8, 9] overlap, merge them into [6,9].

Interval [10, 12] does not overlap with any interval.

Final List after merging overlapping intervals: [1, 5], [6, 9], [10, 12].
Problem approach

Sort intervals by beginning index. First we start with the laft most interval. After that for each interval we see if the beginning of the current left most interval. If not, we push the new interval and that becomes the left most interval. If the intervals overlap, we merge the currsent left most interval with the new interval. To do this, we pop the current left most interval. The lesft end point remains the same. The right end point is the max of the current interval and the current left most interval. Once the merge is done, we push back thge new interval and that becomes the new left most interval


class Solution {
// Need a custom comparator. For C++ use a static declarator. 
private:
static bool my_sort(const vector& x, const vector& y)
{
// Compare the first (left end point) of two vectors.
return x[0] < y[0];
}

public:
vector> merge(vector>& intervals) {

// First things, first. Sort the array by intervals.
std::sort(intervals.begin(),intervals.end(),my_sort);

// Second things second... Declare variables.
vector> sol;

vector tmp;

for(auto& v: intervals){ // Iterate through intervals. 
if(sol.size()<=0)
sol.push_back(v); // If soliution set is empty push back the interval.
else{
tmp = sol.back();
if(tmp[1] sol.push_back(v);
else{ // merge
sol.pop_back();
tmp[1]=max(v[1],tmp[1]);
sol.push_back(tmp);
}
}
}
return sol;
}
};

Try solving now
03
Round
Medium
Video Call
Duration60 Minutes
Interview date19 Apr 2022
Coding problem1

It was the second technical round taken by the senior software developer. During the interview, the interviewer was very friendly and helpful whenever I had any questions. I was asked to introduce myself after he gave his introduction.

1. Palindrome Partitioning

Moderate
25m average time
75% success
0/80
Asked in companies
HSBCMicrosoftGoogle

You are given a string 'S'. Your task is to partition 'S' such that every substring of the partition is a palindrome. You need to return all possible palindrome partitioning of 'S'.

Note: A substring is a contiguous segment of a string.

For Example:
For a given string “BaaB”
3 possible palindrome partitioning of the given string are:
{“B”, “a”, “a”, “B”}
{“B”, “aa”, “B”}
{“BaaB”}
Every substring of all the above partitions of “BaaB” is a palindrome.
Problem approach

We can solve this question using Recursion.
We can start iterate over the array and we will doing partition. Partition would mean that we will be generating sub strings and checking if each of the sub string is palindrome or not. After every partition, every sub string which is palindrome is pushed into a new array.

void f(int ind, string& s,vector>& ans,vector&path){
if(ind==s.size()){
ans.push_back(path);
return;
}
for(int i=ind;i> partition(string s) {
vector>ans;
vectorpath;
f(0,s,ans,path);
return ans;
}
TC - O( (2^N) * average length * (N/2) )
Sc - O(average length * no. of combination)

Try solving now
Do you know this?

TikTok uses _________ to recursively display trending videos ensuring your feed is filled with new content.

Start a Discussion
Similar interview experiences
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Curefit
913 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 2 problems
Interviewed by Curefit
1006 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 7 problems
Interviewed by Curefit
900 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Curefit
463 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
104885 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
49901 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
31104 views
6 comments
0 upvotes