SAFRAN Hiring Challenge | Online Assessment Question | On-Campus (2024)
Question · Posted Jun 2026
Q1: Convert an Array Into a 2D Array With Conditions Problem Statement You are given an integer array nums. Convert it into a 2D array such that: Each row contains only distinct integers. Every occurrence of each integer from nums is used exactly once. The number of rows should be minimum. Return any valid 2D array. Example Input: nums = [1,3,4,1,2,3,1] Output: [[1,3,4,2],[1,3],[1]] Explanation: The first row contains distinct elements. The second row contains the second occurrence of 1 and ...
The full answer & interview discussion are available to premium members.
Log in Create a free account