Find the second largest element in an array.
Difficulty: Medium
Phase: 6 · Mixed Logical Challenges
XP Reward: 20 XP
Topics: Mixed Logical Challenges, Medium
Supported Languages: Python, JavaScript, C, C++, Java
Problem Description
Given two sorted arrays, find their intersection (common elements appearing in both) and print separated by space. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).
Constraints
- -10^9 <= N <= 10^9
Examples
Example 1
Input: 5 1 2 3 4 5 4 2 4 6 8
Output: 2 4
Explanation: Sample execution for input 5 1 2 3 4 5 4 2 4 6 8