Decrypt a twice-encrypted message using known pairs
Company: Upstart
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates the ability to reconstruct and compose bijective character-substitution mappings, testing competency in string manipulation, mapping inference, and basic cipher reasoning.
Part 1: Reverse a List While Filtering Odd Numbers
Constraints
- 0 <= len(nums) <= 10^5
- -10^9 <= nums[i] <= 10^9
Examples
Input: ([2, 3, 4],)
Expected Output: [4, 2]
Explanation: Reverse order is [4, 3, 2], then remove odd numbers.
Input: ([],)
Expected Output: []
Explanation: Edge case: empty input produces an empty list.
Input: ([1, 3, 5],)
Expected Output: []
Explanation: All numbers are odd, so nothing remains.
Input: ([-3, -2, 0, 7, 8],)
Expected Output: [8, 0, -2]
Explanation: Reverse is [8, 7, 0, -2, -3]; keep only evens.