Premium problem95. Ints to Binary Matrix

Hard Locked

Convert the integer vector I into its binary matrix representation, and return the (len(I), 8) array of 0s and 1s:

  • 8 bits per value
  • most-significant bit first

Input

[  0   1   2   3  15  16  32  64 128]

Output

[[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 1]
 [0 0 0 ... 0 1 0]
 ...
 [0 0 1 ... 0 0 0]
 [0 1 0 ... 0 0 0]
 [1 0 0 ... 0 0 0]]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)