Cody

# Problem 1065. Make a 1 hot vector

Solution 1792310

Submitted on 18 Apr 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
assert(isequal(one_hot(1,1),1))

Assertion failed.

2   Fail
assert(isequal(one_hot(2,1),[1 0]))

Assertion failed.

3   Fail
assert(isequal(one_hot(3,3),[0 0 1]))

Assertion failed.

4   Fail
assert(isequal(one_hot(4,1),[1 0 0 0]))

Assertion failed.

5   Fail
assert(isequal(one_hot(5,2),[0 1 0 0 0]))

Assertion failed.

6   Fail
assert(isequal(one_hot(6,1),[1 0 0 0 0 0]))

Assertion failed.

7   Fail
assert(isequal(one_hot(7,1),[1 0 0 0 0 0 0]))

Assertion failed.

8   Fail
assert(isequal(one_hot(8,7),[0 0 0 0 0 0 1 0]))

Assertion failed.

9   Fail
assert(isequal(one_hot(9,7),[0 0 0 0 0 0 1 0 0]))

Assertion failed.

10   Fail
assert(isequal(one_hot(10,4),[0 0 0 1 0 0 0 0 0 0]))

Assertion failed.

11   Fail
assert(isequal(one_hot(11,11),[0 0 0 0 0 0 0 0 0 0 1]))

Assertion failed.

12   Fail
assert(isequal(one_hot(12,1),[1 0 0 0 0 0 0 0 0 0 0 0]))

Assertion failed.

13   Fail
assert(isequal(one_hot(13,6),[0 0 0 0 0 1 0 0 0 0 0 0 0]))

Assertion failed.

14   Fail
assert(isequal(one_hot(14,6),[0 0 0 0 0 1 0 0 0 0 0 0 0 0]))

Assertion failed.

15   Fail
assert(isequal(one_hot(15,12),[0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]))

Assertion failed.

16   Fail
assert(isequal(one_hot(16,13),[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]))

Assertion failed.

17   Fail
assert(isequal(one_hot(17,4),[0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0]))

Assertion failed.

18   Fail
assert(isequal(one_hot(18,9),[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]))

Assertion failed.

19   Fail
assert(isequal(one_hot(19,9),[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]))

Assertion failed.

20   Fail
assert(isequal(one_hot(20,13),[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]))

Assertion failed.