Cody

Solution 392279

Submitted on 28 Jan 2014 by Sourabh
  • Size: 11
  • This is the leading solution.
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   Pass
%% assert(isequal(one_hot(1,1),1))
ans = []
2   Pass
%% assert(isequal(one_hot(2,1),[1 0]))
ans = []
3   Pass
%% assert(isequal(one_hot(3,3),[0 0 1]))
ans = []
4   Pass
%% assert(isequal(one_hot(4,1),[1 0 0 0]))
ans = []
5   Pass
%% assert(isequal(one_hot(5,2),[0 1 0 0 0]))
ans = []
6   Pass
%% assert(isequal(one_hot(6,1),[1 0 0 0 0 0]))
ans = []
7   Pass
%% assert(isequal(one_hot(7,1),[1 0 0 0 0 0 0]))
ans = []
8   Pass
%% assert(isequal(one_hot(8,7),[0 0 0 0 0 0 1 0]))
ans = []
9   Pass
%% assert(isequal(one_hot(9,7),[0 0 0 0 0 0 1 0 0]))
ans = []
10   Pass
%% assert(isequal(one_hot(10,4),[0 0 0 1 0 0 0 0 0 0]))
ans = []
11   Pass
%% assert(isequal(one_hot(11,11),[0 0 0 0 0 0 0 0 0 0 1]))
ans = []
12   Pass
%% assert(isequal(one_hot(12,1),[1 0 0 0 0 0 0 0 0 0 0 0]))
ans = []
13   Pass
%% assert(isequal(one_hot(13,6),[0 0 0 0 0 1 0 0 0 0 0 0 0]))
ans = []
14   Pass
%% assert(isequal(one_hot(14,6),[0 0 0 0 0 1 0 0 0 0 0 0 0 0]))
ans = []
15   Pass
%% assert(isequal(one_hot(15,12),[0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]))
ans = []
16   Pass
%% assert(isequal(one_hot(16,13),[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]))
ans = []
17   Pass
%% assert(isequal(one_hot(17,4),[0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0]))
ans = []
18   Pass
%% assert(isequal(one_hot(18,9),[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]))
ans = []
19   Pass
%% 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]))
ans = []
20   Pass
%% 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]))
ans = []