![]() |
VOOZH | about |
In recent years, the TCS National Qualifier Test (NQT) has become a gateway for many aspiring candidates to kickstart their careers in the tech industry. However, the coding section of the exam has been a subject of debate among candidates due to its ambiguous and sometimes inadequately described questions. In this article, we'll dissect one such coding question from the TCS NQT conducted on April 26th, 2024, shedding light on the issues with its description and providing a detailed example.
One of the questions posed in the coding section of the TCS NQT on April 26th, 2024, revolved around finding all subarrays of a given array whose sum of elements is equal to a specified value, let's call it K.
The problem statement lacked clarity, especially concerning how input should be handled when the size of the array is not provided upfront. Moreover, it failed to specify how input containing non-integer characters should be managed, leading to confusion among candidates.
Consider the following input scenario:
Input: 1 2 3 4 5 -4 -3 ,10
In this example, the input consists of integers separated by spaces, with a comma separating the array from the specified value of K, which is 10. However, the problem statement does not clarify how to handle non-integer characters like commas in the input.
To address the ambiguity in the problem statement, let's provide a solution along with the necessary input handling. Below is the code snippet demonstrating how to handle input until a non-integer character is encountered: