FastPrepMaximum 69 Number
Problems/Maximum 69 Number

Maximum 69 Number

HSBC logoHSBC● EasyNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a HSBC new grad onsite interview. The task is fully known. We chose the function signature and the number limit. Our version is about 99% the same as the reported question.

You are given a positive integer whose decimal digits are only 6 and 9. Change at most one digit and return the largest possible integer.

Function

maximum69Number(num: int) → int

Examples

Example 1

num = 9669return = 9969

Changing the first six produces the largest result.

Example 2

num = 9999return = 9999

No change can improve the number.

Constraints

  • 1 <= num <= 10^9.
  • Every decimal digit is 6 or 9.

Source note: Author-written prompt excerpt retained for source fidelity.

More HSBC interview questions

  • Second Distinct Largest ElementONSITE INTERVIEW · Seen Oct 2026
  • Organization Reputation After Employee DeparturesOA · Seen Nov 2026
  • Remove Vowels from a StringOA · Seen Nov 2026
  • Minimum Deletion Cost for Distinct Adjacent CharactersOA · Seen Oct 2026
  • Distinct Products After Removing One ElementOA · Seen Sep 2026
  • Minimum Cleaning Robot RunsOA · Seen Sep 2026
  • Minimum Satellite Data Transfer IterationsOA · Seen Aug 2026
  • Find ID of SoldierOA · Seen Jun 2026
  • Find Most Frequently Purchased ProductsOA · Seen Jun 2026
  • Minimum Markers to Clear Line SegmentsOA · Seen Nov 2025

Similar questions at other companies

  • Maximize the Chance of Selecting the Best CandidateGoogle · ONSITE INTERVIEWGoogle interview questions
  • Fewest Bills and CoinsCapital One · ONSITE INTERVIEWCapital One interview questions
  • Spend a Budget Across Five Price TiersExpedia · ONSITE INTERVIEWExpedia interview questions
  • Integer BreakAmazon · ONSITE INTERVIEW
  • Maximum Bananas Delivered by a CamelStackAdapt · ONSITE INTERVIEWStackAdapt interview questions
  • UCB1 Multi-Armed Bandit TraceWayfair · ONSITE INTERVIEWWayfair interview questions
  • Reach a Target by Adding CoordinatesJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
  • Server InvestmentRippling · OARippling interview questions
  • Maximum Three-Server Difficulty ScoreVisa · OAVisa interview questions
  • Particle Moves to TargetCresta · OACresta interview questions
All HSBC interview questionsSee HSBC hiring insights
Saved
class Solution {
    public int maximum69Number(int num) {
        // Write your code here.
    }
}
Checking account…