Add office photos
ThoughtWorks logo
Employer?
Claim Account for FREE

ThoughtWorks

3.9
based on 520 Reviews
Video summary
Filter interviews by
Software Developer
Clear (1)

10+ ThoughtWorks Software Developer Interview Questions and Answers

Updated 5 Feb 2024

Q1. Maximum Sum Subarray Problem Statement

Given an array of integers, find the maximum sum of any contiguous subarray within the array.

Example:

Input:
array = [34, -50, 42, 14, -5, 86]
Output:
137
Explanation:

Th...read more

Ans.

Find the maximum sum of any contiguous subarray within an array in O(N) time complexity.

  • Use Kadane's algorithm to find the maximum sum subarray in O(N) time complexity

  • Initialize two variables: max_sum and current_sum to keep track of the maximum sum subarray

  • Iterate through the array and update current_sum by adding the current element or starting a new subarray

  • Update max_sum if current_sum is greater than max_sum

  • Return max_sum as the maximum sum of any contiguous subarray

View 1 answer
right arrow

Q2. Total Unique Paths Problem Statement

You are located at point ‘A’, the top-left corner of an M x N matrix, and your target is point ‘B’, the bottom-right corner of the same matrix. Your task is to calculate the...read more

Ans.

The problem involves finding the total number of unique paths from the top-left to bottom-right cell of a matrix by moving only right or down.

  • Use dynamic programming to solve the problem efficiently.

  • Create a 2D array to store the number of unique paths at each cell.

  • Initialize the first row and first column with 1 as there is only one way to reach them.

  • For each cell (i, j), the number of unique paths is the sum of paths from the cell above and the cell to the left.

  • Return the v...read more

Add your answer
right arrow

Q3. River Crossing: Help Ninja Cross Over

Ninja stands at the start of a wooden bridge over a river. Some segments of the bridge are damaged. The undamaged segments, marked as 'safe', are listed in an array SAFE, s...read more

Ans.

Check if Ninja can cross the river by jumping from one safe segment to another based on given constraints.

  • Iterate through the 'SAFE' array and check if Ninja can make the required jumps to reach the last safe segment.

  • Ensure that the next jump is either 'X' - 1, 'X', or 'X' + 1 units from the previous jump.

  • Return 'true' if Ninja can successfully cross the river, otherwise return 'false'.

Add your answer
right arrow

Q4. Subtree Node Count Problem

We are provided with a tree containing 'N' nodes, numbered from 0 to N-1. The objective is to determine the total number of nodes within each subtree of the provided tree. Specificall...read more

Ans.

Given a tree with N nodes, find the number of elements in each subtree rooted at every node.

  • Traverse the tree using Depth First Search (DFS) to calculate subtree sizes for each node.

  • Use an array to store subtree sizes for each node, starting with leaf nodes having size 1.

  • The subtree size of a node is the sum of subtree sizes of its children plus 1 for the node itself.

Add your answer
right arrow
Discover ThoughtWorks interview dos and don'ts from real experiences

Q5. Left View of a Binary Tree

Given a binary tree, your task is to print the left view of the tree. The left view of a binary tree contains the nodes visible when the tree is viewed from the left side.

Input:

The ...read more
Ans.

The task is to print the left view of a binary tree, which contains the nodes visible when the tree is viewed from the left side.

  • Traverse the tree in a level order manner and keep track of the leftmost node at each level.

  • Use a queue to perform level order traversal.

  • Print the leftmost node at each level to get the left view of the binary tree.

Add your answer
right arrow

Q6. Middle of a Linked List

You are given the head node of a singly linked list. Your task is to return a pointer pointing to the middle of the linked list.

If there is an odd number of elements, return the middle ...read more

Ans.

Return the middle element of a singly linked list, or the one farther from the head if there are even elements.

  • Traverse the linked list with two pointers, one moving twice as fast as the other

  • When the fast pointer reaches the end, the slow pointer will be at the middle

  • Return the element pointed to by the slow pointer

Add your answer
right arrow
Are these interview questions helpful?
Q7. What is the difference between CHAR and VARCHAR2 data types in SQL?
Ans.

CHAR is fixed length while VARCHAR2 is variable length in SQL.

  • CHAR stores fixed length strings, padding with spaces if necessary.

  • VARCHAR2 stores variable length strings, not padding with spaces.

  • CHAR is faster for fixed length data, VARCHAR2 is more flexible for varying length data.

View 1 answer
right arrow
Q8. Design a Doctor Appointment System and provide some test cases.
Ans.

Design a Doctor Appointment System with test cases

  • Create a database to store doctor information, patient information, and appointment details

  • Implement a user interface for patients to schedule appointments with available doctors

  • Include features like appointment reminders, cancellation, and rescheduling

  • Test cases: 1. Schedule appointment successfully 2. Cancel appointment 3. Reschedule appointment

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop
Q9. What is the difference between overloading and overriding?
Ans.

Overloading is having multiple methods in the same class with the same name but different parameters, while overriding is implementing a method in a subclass that is already defined in the superclass.

  • Overloading involves multiple methods with the same name but different parameters.

  • Overriding involves implementing a method in a subclass that is already defined in the superclass.

  • Overloading is resolved at compile time based on the method signature, while overriding is resolved ...read more

Add your answer
right arrow
Q10. What are the various types of constructors in C++?
Ans.

There are three types of constructors in C++: default constructor, parameterized constructor, and copy constructor.

  • Default constructor: Constructor with no parameters.

  • Parameterized constructor: Constructor with parameters.

  • Copy constructor: Constructor that initializes an object using another object of the same class.

  • Example: // Default constructor ClassName() {} // Parameterized constructor ClassName(int x, int y) : x(x), y(y) {} // Copy constructor ClassName(const ClassName&...read more

Add your answer
right arrow

Q11. Add one API to the existing repository

Ans.

The API allows users to retrieve weather data based on location.

  • Create a new endpoint that accepts a location parameter

  • Use a weather API service to fetch weather data based on the location

  • Return the weather data in a standardized format, such as JSON

Add your answer
right arrow

Q12. Add some feature to the project

Ans.

The feature added to the project is a user authentication system.

  • Implement a login page with username and password fields.

  • Create a database table to store user credentials.

  • Hash and salt passwords for secure storage.

  • Implement password reset functionality.

  • Add user roles and permissions for access control.

Add your answer
right arrow

More about working at ThoughtWorks

Back
Awards Leaf
AmbitionBox Logo
#2 Best IT/ITES Company - 2022
Awards Leaf
HQ - Chicago, Illinois, United States (USA)
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at ThoughtWorks Software Developer

based on 7 interviews
2 Interview rounds
Coding Test Round
Technical Round
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

Zoho Logo
4.3
 • 31 Interview Questions
NeoSOFT Logo
3.6
 • 14 Interview Questions
View all
Recently Viewed
INTERVIEWS
Sanmar Group
No Interviews
INTERVIEWS
Sanmar Group
No Interviews
INTERVIEWS
Sanmar Group
No Interviews
DESIGNATION
DESIGNATION
INTERVIEWS
Barclays PLC
No Interviews
INTERVIEWS
Sanmar Group
No Interviews
INTERVIEWS
ThoughtWorks
No Interviews
DESIGNATION
INTERVIEWS
Barclays PLC
No Interviews
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter