Tcs Coding Questions 2021 [updated]

Problem Statement: Find all numbers between two given integers L and R (inclusive) such that:

Given an array and a target sum, count pairs (i,j) where i<j and arr[i]+arr[j] = sum.

| Section | Questions | Duration | |---|---|---| | Programming Logic (MCQ) | 10 Questions | 15 minutes | | Hands-on Coding Question 1 | 1 Question | 15 minutes | | Hands-on Coding Question 2 | 1 Question | 30 minutes |

Often included two questions. The difficulty was medium to hard. Questions involved advanced data structures, optimization, or complex string manipulation. Tcs Coding Questions 2021

Input: 1 2 3 4 5 6 7 8 9 10 11 12 Output: 1 2 3 4 8 12 11 10 9 5 6 7

n = int(input()) arr = list(map(int, input().split())) arr.sort() mid = n // 2

Example:

def count_pairs(arr, target): count = 0 for i in range(len(arr)): for j in range(i+1, len(arr)): if arr[i] + arr[j] == target: count += 1 return count

In 2021, TCS typically divided its coding assessments into two main categories based on the job profile:

: Advanced Data Structures, Dynamic Programming, Graph Algorithms. 2. High-Frequency Topics & Weightage Problem Statement: Find all numbers between two given

TCS coding questions in 2021 focused on rather than advanced algorithms. If you can solve string manipulations, basic array problems, and number series, you can easily clear the coding section. Practice consistently on platforms like TCS iON , CodeChef , or HackerRank under timed conditions.

Medium Marks: 15

Copyright Jolly Sterling Index © 2026.Az

Saytdakı materialların istifadəsi zamanı istinad edilməsi vacibdir. Məlumat
internet səhifələrində istifadə edildikdə hiperlink vasitəsi ilə istinad mütləqdir.

Tcs Coding Questions 2021