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

SDE - 1

Thought Works
upvote
share-icon
2 rounds | 10 Coding problems

Interview preparation journey

expand-icon
Journey
I started preparing for this job interview during my graduation in the forth year as I have to apply for campus placements. I took a Java DSA course from coding ninjas. I practice questions from coding ninjas course, leetcode and codechef.
Application story
Thoughtworks came Oncampus. So I applied throught that. The CTC was around 8lpa. 1st round was resume shortlisting. I got shortlisted in that round. Next day I got test link.
Why selected/rejected for the role?
I was not selected for the position because I did not possess the necessary expertise with the OOPS concept. This may have been a crucial factor in the decision-making process, as the role likely required proficiency in that particular technology.
Preparation
Duration: 3 months
Topics: Data Structures, Pointers, OOPS, Algorithms, Dynamic Programming, My SQL, Database, Operating System
Tip
Tip

Tip 1 : Practice Atleast 250 Questions on GFG/Leetcode
Tip 2 : For DSA questions in interviews, start explaining from the brute force approach and then move to the optimal one. Convey your thought process to the interviewers, so that they can help you out if you get stuck.
Tip 3 : Do not write anything that you are not confident of in resume
Tip 4 : Do atleast 2 projects

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

Tip 1: Try to include at least one development project in your resume.
Tip 2: Interviewer will ask anything from your resume so be prepared for it.
Tip 3 : Don't mention some random projects which you are not sure about or copied from Google or somewhere else.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date21 Sep 2021
Coding problem7

This test consists of MCQ based on Aptitude and DSA. Also we have to solve 3 coding questions of easy to medium level

1. Rearrange Alternatively

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

Given an array arr of size N containing positive and negative integers. Arrange the array alternatively such that every non-negative integer is followed by a negative integer and vice-versa.

Note:
The number of positive integers and negative integers may not be equal. In such cases, add the extra integers at the end.
For Example:
For array {4, -9, -2, 6, -8}, the output will be {-9, 4, -2, 6, -8}

For array {1, 2, 3, -5}, the output will be {-5, 1, 2, 3}   
Problem approach

The idea is to use an auxiliary array. We maintain two pointers one to the leftmost or smallest element and the other to the rightmost or largest element. We move both pointers toward each other and alternatively copy elements at these pointers to an auxiliary array. Finally, we copy the auxiliary array back to the original array.

Try solving now

2. Subtree of Another Tree

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

Given two binary trees T and S, check whether tree S has exactly the same structure and node values with a subtree of T, i.e., check if tree S is a subtree of the tree T.

A subtree of a tree T is a tree S consisting of a node in T and all of its descendants in T. The subtree corresponding to the root node is the entire tree; the subtree corresponding to any other node is called a proper subtree.

Problem approach

The idea is to check at every node for the subtree.

Follow the steps below to solve the problem:

Traverse the tree T in preorder fashion
For every visited node in the traversal, see if the subtree rooted with this node is identical to S.
To check the subtree is identical or not traverse on the tree S and T simultaneously
If a visited node is not equal then return false else continue traversing the whole tree S is traversed

Try solving now

3. Majority element

Easy
15m average time
85% success
0/40
Asked in companies
AmazonInfo Edge India (Naukri.com)HCL Technologies

You have been given an array/list 'ARR' consisting of 'N' integers. Your task is to find the majority element in the array. If there is no majority element present, print -1.

Note:
A majority element is an element that occurs more than floor('N' / 2) times in the array.
Problem approach

A better solution is to use sorting. First, sort all elements using a O(nLogn) algorithm. Once the array is sorted, we can find all required elements in a linear scan of array. So overall time complexity of this method is O(nLogn) + O(n) which is O(nLogn).

Try solving now

4. What will be the output following pseudo code?

Integer p,q,r

Set p=2, q=5, r=9 If((q+9)<p || (q&p)<p)        r=(p&p)+q Else        p=r+p End if r=q+p Print p+q+r

Problem approach

Ans:- 14

5. DS Question

Which data structures finds its use in recursion?

Problem approach

Ans:- Stacks

6. DS Question

Which of the following highly uses the concept of an array?

A) Binary Search tree
B) Caching
C) Spatial locality
D) Scheduling of Processes

Problem approach

Ans:- The answer is c, i.e., Spatial locality. Here, spatial locality means that the instruction accessed recently, then the nearby memory location would be accessed in the next iteration. As we know that in an array, all the elements are stored in a contiguous block of memory, so spatial locality is accessed quickly

7. What is the output of the below code?

#include   int main()  {    

 int arr[5]={10,20,30,40,50};    

 printf("%d", arr[5]);       

 return 0;  }

Problem approach

Ans:- Garbage Value

02
Round
Hard
Video Call
Duration120 minutes
Interview date25 Sep 2021
Coding problem3

This round was a system design round related to OOPS concept. Interviewer given me a problem statement and ask me to code this in a java compiler. He given me 1/2 hr to understand and read the problem and latter ask to code and explain it.

1. System Design Question

Rent a Ride” As a customer to Rent a Ride you book a cab. We charge you as per the distance covered. We charge 8rs/km. The moment you click the button to RIDE, we search for the nearby drivers who will accept your ride. Suppose there are 15 drivers near your location, then we send the request to the first driver who is closest to you, then the second, and so on. There are a few conditions though, based on which we can not send the request to the nearby driver.

Condition 1: If the driver rating is lower than 4. (out of 5)

Condition 2: If you selected a specific car, and that car driver is not the closest one.


In case there is no driver present as per your request for the car, we will ask you to select some other car. A table was given having drivers, cars model, their ratings, and distance from the customer, and using this data we have to provide the most appropriate car to the customer, with the calculated fare. I was able to solve the problem in the given time, interviewers kept on asking questions about my code, and I answered every question. This round lasted 2 hours.

Problem approach

Always write a neat and clean code containing all the conditions. Use the variable names appropriately, the focus on them a lot. Make sure to use “Access modifiers wherever necessary”. Don’t forget to use a camel case

2. OOPs Questions

What are OOPs concept and explain its 4 pillar.

3. OOPs Question

Does java supports multiple inheritance.

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 remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Thought Works
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Thought Works
1222 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Thought Works
552 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Thought Works
660 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by BNY Mellon
6366 views
3 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by BNY Mellon
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by CIS - Cyber Infrastructure
2198 views
0 comments
0 upvotes