FastPrepSecond Distinct Largest Element
Problems/Second Distinct Largest Element

Second Distinct Largest Element

MulticoreWare logoMulticoreWare● EasyOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

Source note: This problem is backed by a real MulticoreWare OA report. The report clearly specified duplicates and the second-largest distinct objective, but it did not define the fewer-than-two-values case or include the exact interface, examples, or constraints. The core task match is about 95%; judged arrays contain at least two distinct values.

Given an integer array nums containing at least two distinct values, return its second-largest distinct value.

Repeated occurrences of the largest value do not count as a separate value.

Function

secondLargestDistinct(nums: int[]) → int

Examples

Example 1

nums = [5,1,5,3]return = 3

Example 2

nums = [2,2,1]return = 1

More MulticoreWare Online Assessment questions

  • Minimum Coin ChangeOA · Seen Jul 2026

Similar questions at other companies

  • Missing IntervalsIBM · OAIBM interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Two SumAmazon · OA · PHONE SCREEN
  • Competition Winner and Runner-Up (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Server InvestmentRippling · OARippling interview questions
  • Book Reading EveningsGoogle · OAGoogle interview questions
See MulticoreWare hiring insights
Saved
class Solution {
    public int secondLargestDistinct(int[] nums) {
      // write your code here
    }
}
Checking account…