Direct Answer: What are the primary topics in TCS Digital?
TCS Digital coding rounds primarily focus on Arrays, Strings, Dynamic Programming, and Graph traversal. Candidates are tested on 2 coding problems: one medium (30 marks) and one hard (50 marks) within 60 minutes.
Question 1: Longest Palindromic Substring
Given a string s, return the longest palindromic substring in s.
def longestPalindrome(s: str) -> str:
res = ""
for i in range(len(s)):
# Odd length
l, r = i, i
while l >= 0 and r < len(s) and s[l] == s[r]:
if (r - l + 1) > len(res):
res = s[l:r+1]
l -= 1
r += 1
return res
Frequently Asked Questions
How many coding questions are there in TCS Digital?
There are 2 coding questions in the TCS Digital test, ranging from medium to hard difficulty.
Can I use Python for TCS Digital?
Yes, TCS Digital supports C++, Java, Python, and C in the official compiler.
