FastPrepFind Maximum Two-Digit Fragment
Problems/Find Maximum Two-Digit Fragment

Find Maximum Two-Digit Fragment

PayPay logoPayPay● EasyPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamples

Problem statement

You are given a string consisting of digits. Find the biggest two-digits value that is a consistent fragment of the given string.

For example, two-digit consistent fragments of "50552" are ["50","05","55","52"], representing the numbers [50,5,55,52]. The biggest value among them is 55.

Function

solution(S: String) → int

Write a function:

class Solution { public int solution(String S); }

that, given a string S consisting of digits, returns the maximum two-digit value that is a consistent fragment of S.

Examples

Example 1

S = "50552"return = 55

The two-digit consistent fragments of "50552" are ["50","05","55","52"], representing the numbers [50,5,55,52]. The biggest value among them is 55.

More PayPay interview questions

  • Next Greater Value in a Circular ArrayPHONE SCREEN · Seen Sep 2026
  • Sum Consecutive Identical DigitsOA · Seen Mar 2024
  • Palindromic Array TransformationOA · Seen Nov 2023
  • Calculate ChangeOA · Seen Feb 2022

Similar questions at other companies

  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Valid ParenthesesByteDance · PHONE SCREENByteDance interview questions
  • Detect a Straight FlushTemu · PHONE SCREENTemu interview questions
  • Check if a String Is a PalindromeCisco · PHONE SCREENCisco interview questions
  • Halfway Course in a Single TrackCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Longest Common PrefixKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
  • Format a Signed Integer with CommasHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Reverse a StringAmazon · PHONE SCREEN
All PayPay interview questionsSee PayPay hiring insights
Saved
class Solution {
    public int solution(String S) {
      // write your code here
    }

}
Checking account…