FastPrepSmallest Adjacent Concatenation
Problems/Smallest Adjacent Concatenation

Smallest Adjacent Concatenation

IDFC Bank logoIDFC Bank● EasyOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source omits a runnable function signature. The judged core task matches the visible source at about 98%.

You are given an array arr of positive integers. Group the array into fixed adjacent pairs: (arr[0], arr[1]), (arr[2], arr[3]), and so on.

For each complete pair, concatenate the decimal representation of the first number with the decimal representation of the second number, without reordering either number. If the array has odd length, treat the final unpaired number as its own candidate.

Return the smallest candidate value.

Function

smallestAdjacentConcatenation(arr: int[]) → int

Examples

Example 1

arr = [15,24,34,10,12,21,45,67]return = 1221

The fixed adjacent pairs produce 1524, 3410, 1221, and 4567. The smallest value is 1221.

Example 2

arr = [9,87,6]return = 6

The complete pair produces 987. The unpaired final value 6 is also a candidate and is smaller.

Constraints

  • 1 <= arr.length <= 10^5
  • 1 <= arr[i] <= 10^4

More IDFC Bank problems

  • Employee Free TimeONSITE INTERVIEW · Seen Aug 2026
  • Minimum Cake CutsOA · Seen Jul 2026
  • Find All People With SecretONSITE INTERVIEW · Seen Jul 2026
All IDFC Bank interview questionsSee IDFC Bank hiring insights
Saved
class Solution {
    public int smallestAdjacentConcatenation(int[] arr) {
      // write your code here
    }
}
Checking account…