The HCLTech coding round gives you 2 problems in about 20 minutes, to be solved in C, C++, Java or Python. The problems are shorter than TCS or Wipro coding rounds — string manipulation, array traversal and digit logic — but the clock is tighter, so fluency matters more than algorithmic depth.
What HCLTech coding questions test
- String manipulation — reversing words, run-length encoding, moving characters
- Array and matrix traversal (including spiral order)
- Digit extraction and simulation (borrow counting, digit sums)
- Palindromes, vowel counting and character-case logic
- Reading input and printing output exactly as specified
Practice real HCLTech coding problems
These problems appeared in memory-based HCLTech papers. Try each one yourself before revealing the approach — solutions are provided in Python, Java and C++.
Given a string containing alphanumeric characters and some '#' characters, write a program to move all the '#' characters to the front of the string while maintaining the relative order of the other characters.
Input: Move#Hash#to#Front
Output: ###MoveHashtoFront
The three '#' characters move to the front; every other character keeps its original relative order.
- 1 ≤ |S| ≤ 10^5
- S contains letters, digits and '#' characters
You are given a string with consecutively repeated characters. Reduce it by representing each run of repeated characters as the character followed by its count — but only when the count is greater than 1.
Input: aabbbbeeeeffggg
Output: a2b4e4f2g3
Each run is replaced by the character plus its count.
Input: abbc
Output: ab2c
Characters that appear once are written without a count.
- 1 ≤ |S| ≤ 10^5
- S contains only lowercase letters
You are given two numbers, number1 and number2. Write a program to count the number of borrow operations needed when subtracting number2 from number1 using the school method. If the subtraction is not possible (number1 is less than number2), print "Not possible".
Input: number1 = 754, number2 = 658
Output: 2
Units place: 4 − 8 needs a borrow. Tens place: (5 − 1) − 5 = 4 − 5 needs a second borrow. Hundreds place: (7 − 1) − 6 needs none — 2 borrows in total.
Input: number1 = 654, number2 = 666
Output: Not possible
654 < 666, so the subtraction is not possible.
- 0 ≤ number2, number1 ≤ 10^9
Twenty minutes for two problems means no time to debug from scratch — dry-run your loop on the sample input before submitting. Aiming for Momentum or Polaris in the AMP program? The upgrade assessments demand proper DSA: hashing, two-pointer and sorting-based problems.

