Interesting OA question

Revision en1, by bus_u_he, 2024-07-18 20:03:48

I recently took an OA with a question involving n arrays of size m. The task was to create an array A of size n by choosing one element from each array. Then, we had to find the minimum value of A0 | A1 | A2 | ... | An-1 (bitwise OR of all elements in A).

I used recursive DP, considering two options: either go forward in the same array or pick the current element and move to the start of the next array. However, this approach gave incorrect results for 3 out of 10 test cases. Can anyone help me identify what I missed or if I made an unforced error?

Tags dsa, online assessment

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English bus_u_he 2024-07-18 20:05:25 0 (published)
en1 English bus_u_he 2024-07-18 20:03:48 580 Initial revision (saved to drafts)