Interesting OA question

Revision en3, by bus_u_he, 2024-07-19 04:22:12

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) and n<1000,m<1000 and each element in those n arrays is less than 100000.

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
en3 English bus_u_he 2024-07-19 04:22:12 73
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)