Company-style OA practice sets with full problem statements, sample test cases, and solutions.
Have you recently taken tcs's Online Assessment or coding test? Share the questions, test cases, or assessment patterns you encountered. Earn SWE180 Coins for every verified submission and use them to unlock other company OA sets and premium tools for free!
Given a string s consisting of lowercase Latin letters, find the first non-repeating character in it and return its index (0-indexed).
If it does not exist, return -1.
Example 1
Input
leetcode
Output
0
Explanation
'l' appears once at index 0 and does not repeat anywhere in the string.
Example 2
Input
loveleetcode
Output
2
Explanation
'v' at index 2 is the first character with frequency 1.
Given an array nums of size n, return the majority element.
The majority element is the element that appears strictly more than floor(n / 2) times. You may assume that the majority element always exists in the array.
Solve the problem in linear time and in O(1) space.
Example 1
Input
7 2 2 1 1 1 2 2
Output
2
Explanation
2 appears 4 times, which is > 7 / 2 = 3. Majority element is 2.
Gain complete transparency into the tcs online assessment process. Prepare effectively with real, verified coding challenges, test patterns, and platform details.
Wondering what top companies are actually asking in their initial screening rounds? We provide exact Data Structures, Algorithms, and logical reasoning questions reported by candidates who recently took the tcs online tests. Stop guessing and start practicing the right problems.
Understand exactly how many questions to expect, the typical time limits, and the platforms used (e.g., HackerRank, Codility, CodeSignal). Knowing the format in advance is the first step to clearing the tcs OA.