Suppose I have a sequence of integers and a number n < 30. How can I produce an array (of length n) that is 0 in all places except at the indices specified by the sequence (where it should be 1)?
For instance
Input:
Seq(1, 2, 5)
7
Output:
Array(0, 1, 1, 0, 0, 1, 0)