FastPrepSecond Distinct Largest Element
Problems/Second Distinct Largest Element

Second Distinct Largest Element

MulticoreWare logoMulticoreWare● EasyOA
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 problems

  • Minimum Coin ChangeOA · Seen Jul 2026
See MulticoreWare hiring insights
Saved
public int secondLargestDistinct(int[] nums) {
  // write your code here
}
Checking account…