Given three lists of integers, return the sorted list of distinct values that appear in all three lists. If any input list is null or no values are common, return an empty list. Each value in the result should appear exactly once.
Examples:
Input: a = [1, 2, 3], b = [2, 3, 4], c = [3, 4, 5]
Output: [3]
Explanation: Only 3 appears in all three lists
Input: a = [1, 2, 3, 4], b = [2, 3, 4, 5], c = [3, 4, 5, 6]
Output: [3, 4]
Explanation: 3 and 4 appear in all three lists, sorted ascending
Input: a = [1, 2], b = [3, 4], c = [5, 6]
Output: []
Explanation: No common values across the lists
Input: a = [], b = [1], c = [1]
Output: []
Explanation: An empty list has no common values
Input: a = null, b = [1], c = [1]
Output: []
Explanation: A null list yields an empty result
Apex Code Editor
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
🏆 All Time Leaderboard
Contest runs January 1, 1970 - December 31, 9999. Complete challenges to climb the leaderboard!
Points are calculated for challenges completed during the contest period.