thecodingcompany
Programming

Java coding practice

Still the backbone of large-company hiring rounds and service-based MNC tests.

Exercises6
FormatPrompt + hint

6 exercises

Try each one before reading the hint. If you finish without using the hint, move on; if the hint is not enough, work the neighbouring DSA pattern.

01Reverse an integer
TaskReverse the digits of an integer, handling negative numbers and overflow.
HintPop digits with % 10 and build the result with result * 10 + digit; check bounds before multiplying.
02Check an Armstrong number
TaskDetermine whether a number equals the sum of its digits each raised to the power of the digit count.
HintCount the digits first, then sum Math.pow(digit, count).
03Find duplicate elements in an array
TaskPrint every element that appears more than once, without sorting.
HintUse a HashSet: if add() returns false, that element is a duplicate.
04Fibonacci with memoisation
TaskCompute the nth Fibonacci number efficiently for large n.
HintUse an array or HashMap to cache computed values and avoid exponential recursion.
05Palindrome number without converting to String
TaskCheck whether an integer is a palindrome using arithmetic only.
HintBuild the reversed half and compare it to the remaining half.
06Matrix transpose
TaskReturn the transpose of a given 2D array.
HintCreate the result with swapped dimensions and assign result[j][i] = matrix[i][j].

Practise here. Get placed there.

Prep+ is unlimited practice. When you are ready to turn it into an offer, TCC Placement Partner handles portfolio, resume and interviews.