FastPrepFind Max Sum with Same First and Last Digit
Problems/Find Max Sum with Same First and Last Digit

Find Max Sum with Same First and Last Digit

Microsoft logoMicrosoft● EasyFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

Given an array with integers, find the maximum sum of any 2 numbers whose first and last digits match.

E.g - [ 2, 36, 45, 306, 415] -> 36 + 306 < 45 + 415

Ans - 460

Function

findMaxSumWithSameFirstAndLastDigit(nums: int[]) → int

Examples

Example 1

nums = [2, 36, 45, 306, 415]return = 460

The maximum sum of any 2 numbers whose first and last digits match is obtained by adding 45 and 415, which gives us 460.

More Microsoft interview questions

  • Maximum Score with Prime JumpsOA · Seen Dec 2026
  • Minimum Non-Adjacent Selection CapabilityOA · Seen Dec 2026
  • Config Store with Priority OverridesPHONE SCREEN · Seen Nov 2026
  • Authentication SystemOA · Seen Nov 2026
  • Bad Request AlertsONSITE INTERVIEW · Seen Nov 2026
  • Maximum String OperationsOA · Seen Nov 2026
  • Minimum Cost to Process Priority TasksOA · Seen Nov 2026
  • Most Visited Sprint MarkerOA · Seen Nov 2026
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Valid ParenthesesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Count Valid Square PairsAuxoAI · OA
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Distinct Products After Removing One ElementHSBC · OAHSBC interview questions
  • Stock PricesRubrik · OARubrik interview questions
  • Get Max Discount PairsAmazon · OA
  • Make Layer Times OddPatreon · OAPatreon interview questions
  • Find Number of Interesting PairsThe D.E. Shaw Group · OAThe D.E. Shaw Group interview questions
  • Nums That Are Divisible by N 🍋Two Sigma · OATwo Sigma interview questions
  • Find Mean and ModeCisco · OACisco interview questions
  • Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions

Microsoft interview experiences

  • Microsoft OA Questions, October 2026: 4 Experiences
  • Microsoft Experienced SWE Phone Screen: 1 Experience
  • Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
  • Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
  • Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
  • Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)
All Microsoft interview questionsSee Microsoft hiring insights
Saved
class Solution {
    public int findMaxSumWithSameFirstAndLastDigit(int[] nums) {
      // write your code here
    }

}
Checking account…