There is a stadium with 'N' rows and 'M' seats in each row. The seats are represented by a 2D array where arr[i][j] represents the ticket price of that seat. A group of friends wants to book seats such that they all sit in the same row and adjacent columns . Given the number of friends 'K', find the minimum total price the group has to pay to sit together. If they cannot sit together in any row, print -1.
: Palindrome numbers, Prime numbers in a range, Armstrong numbers, and Strong numbers. 2. String Manipulation Great Learning
print(are_anagrams("Listen", "Silent")) # Output: True Tcs Coding Questions 2021
The 2021 questions were predominantly centered on data structures and mathematical logic. High-frequency topics included:
balance = 500 n = int(input()) for _ in range(n): t, amt = map(int, input().split()) if t == 1: balance += amt print(balance) elif t == 2: if amt <= balance: balance -= amt print(balance) else: print("Insufficient Balance") There is a stadium with 'N' rows and 'M' seats in each row
In 2021, Python was the fastest to write for TCS. Learn split() , join() , list comprehensions, and dictionary get() .
(7.0 LPA) roles. For those looking to master these patterns, this guide breaks down the core topics, frequently asked questions, and the exam environment. 2021 Exam Structure & Rules The coding section typically consists of two questions with a shared time limit of 90 minutes Given the number of friends 'K', find the
Dynamic Programming (e.g., Coin Change, Longest Common Subsequence). Graph Theory (e.g., finding paths in a matrix).
Given a string s , remove consecutive duplicate characters. Keep only the first occurrence of each group.
2008-2017 © Florian Thurnwald. All rights reserved. Privacy Policy | Imprint