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 | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 Months
Topics: Data structures, Algorithms, OOPS, Operating System, DBMS, Computer Networks
Tip
Tip

Tip 1 : Practice DSA questions daily (atleast 1), Be consistent.
Tip 2 : Make proper notes for last time revision of various algorithms and techniques.
Tip 3 : Do not copy projects for resume.

Application process
Where: Campus
Eligibility: 8.5 CGPA and above
Resume Tip
Resume tip

Tip 1 : Make a single page resume, recruiters don't have enough time to go through multi-page resume.
Tip 2 : Do not put false things on resume, be yourself as much as you can.

Interview rounds

01
Round
Easy
Video Call
Duration45 Minutes
Interview date31 Jul 2021
Coding problem2

This round was held on Google Meet Video Call at 10:30 A.M. There was a single Interviewer and he was very helpful.

1. Time To Burn Tree

Hard
50m average time
50% success
0/120
Asked in companies
Cars24CurefitShareChat

You have a binary tree of 'N' unique nodes and a Start node from where the tree will start to burn. Given that the Start node will always exist in the tree, your task is to print the time (in minutes) that it will take to burn the whole tree.


It is given that it takes 1 minute for the fire to travel from the burning node to its adjacent node and burn down the adjacent node.


For Example :
For the given binary tree: [1, 2, 3, -1, -1, 4, 5, -1, -1, -1, -1]
Start Node: 3

    1
   / \
  2   3
     / \
    4   5

Output: 2

Explanation :
In the zeroth minute, Node 3 will start to burn.

After one minute, Nodes (1, 4, 5) that are adjacent to 3 will burn completely.

After two minutes, the only remaining Node 2 will be burnt and there will be no nodes remaining in the binary tree. 

So, the whole tree will burn in 2 minutes.
Problem approach

After thinking for some time I got that he wants me to find the diameter of BST because diameter will be the longest path for fire to travel.
I already solved the diameter problem earlier so it doesn't took me me much time to solve it.

Try solving now

2. Longest Decreasing Subsequence

Moderate
35m average time
60% success
0/80
Asked in companies
FlipkartCurefitAmazon

You are given an array/list ARR consisting of N integers. Your task is to find the length of the longest decreasing subsequence.

A subsequence is a sequence of numbers obtained by deleting zero or more elements from the array/list, keeping the relative positions of elements same as it was in the initial sequence. A decreasing subsequence is a subsequence in which every element is strictly less than the previous number.

Note:

There can be more than one subsequences with the longest length.
For example:-
For the given array [5, 0, 3, 2, 9], the longest decreasing subsequence is of length 3, i.e. [5, 3, 2]
Note:
Try to solve the problem in O(N log N) time complexity.
Problem approach

I first thought of the brute force approach. Then tried to solve for LIS which I had already solved once. Then implemented the approach of DP for LDS.

Try solving now
02
Round
Medium
Video Call
Duration45 Minutes
Interview date31 Jul 2021
Coding problem2

It held at morning 10 AM. The interviewer was very friendly. I was asked to solve 2 coding questions and was continuously provided with hints by the interviewer.
Question was on Array and Trees.

1. Buy and Sell Stock

Hard
0/120
Asked in companies
Samsung R&D InstituteMicrosoftSalesforce

You are Harshad Mehta’s friend. He told you the price of a particular stock for the next ‘n’ days.


You are given an array ‘prices’ which such that ‘prices[i]’ denotes the price of the stock on the ith day.


You don't want to do more than 2 transactions. Find the maximum profit that you can earn from these transactions.


Note

1. Buying a stock and then selling it is called one transaction.

2. You are not allowed to do multiple transactions at the same time. This means you have to sell the stock before buying it again. 
Example:
Input: ‘n’ = 7, ‘prices’ = [3, 3, 5, 0, 3, 1, 4].

Output: 6

Explanation: 
The maximum profit can be earned by:
Transaction 1: Buying the stock on day 4 (price 0) and then selling it on day 5 (price 3). 
Transaction 2: Buying the stock on day 6 (price 1) and then selling it on day 6 (price 4).
Total profit earned will be (3 - 0) + ( 4 - 1) = 6. 
Problem approach

First I found that this can easily be done using the brute force approach of taking a hashmap for storing all the numbers (from min value in the input range to the maximum value in the input range )with their frequency of appearance. then I will again run a loop for each query range and output the values which will be greater than k.
in this solution 50% of the test cases gives TLE.

Then I realized that I need not to run the loop for each and every range rather I should take a array of 100000 size and :
first mark the start and end of each range in one loop
then fill the frequencies for the between elements by just looping from min to max value in my range
then for each query I got my answer in constant time by subtracting the frequency of the range elements from frequency array.

Try solving now

2. Convert Bst To The Greater Sum Tree

Moderate
30m average time
70% success
0/80
Asked in companies
AmazonMathworksCurefit

You have been given a Binary Search Tree of integers. You are supposed to convert it to a greater sum tree such that the value of every node in the given BST is replaced with the sum of the values of all the nodes which are greater than the value of the current node in the tree.

A Binary Search Tree is a tree, whose internal nodes each store a value greater than all the values in the node's left subtree and less than those in its right subtree.

Note :

You need to modify the given tree only. You are not allowed to create a new tree.
For example:
For the given binary search tree

Example

11 will be replaced by {15 + 29 + 35 + 40}, i.e. 119.
2 will be replaced by {7 + 11 + 15 + 29 + 35 + 40}, i.e. 137.
29 will be replaced by {35 + 40}, i.e. 75.
1 will be replaced by {2 + 7 + 11 + 15 + 29 + 35 + 40}, i.e. 139.
7 will be replaced by {11 + 15 + 29 + 35 + 40}, i.e. 130.
15 will be replaced by {15 + 29 + 35 + 40}, i.e. 104.
40 will be replaced by 0 {as there is no node with a value greater than 40}.
35 will be replaced by {40}, i.e. 40.
Problem approach

First I wrote the post order traversal of input. Then by simply doing post-order traversal and performing swapping in between.

Try solving now
03
Round
Easy
HR Round
Duration30 Minutes
Interview date31 Jul 2021
Coding problem0

This was a Technical + HR interview. It was in the afternoon around 12 pm. The interviewer wanted to know whether or not I had built some projects related to this field. Most of the interview went by him asking questions based on my projects. First I was asked to explain about a project then a lot of follow-up questions were asked.

Here's your problem of the day

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

Skill covered: Programming

How do you write a single-line comment in C++?

Choose another skill to practice
Start a Discussion
Similar interview experiences
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Curefit
909 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 2 problems
Interviewed by Curefit
999 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 7 problems
Interviewed by Curefit
892 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Curefit
869 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
104644 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
49761 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
31029 views
6 comments
0 upvotes