2 ms·
you have the common problems with non-uniqueness and with extra elements. Your spec is met by: SORT(1,2,3,4,5,5,6) = 1,2,3,4,5,6 SORT(1,2,3,4,5,5,6) =
by inigyou 3mo ago
you have the common problems with non-uniqueness and with extra elements. Your spec is met by:
SORT(1,2,3,4,5,5,6) = 1,2,3,4,5,6
SORT(1,2,3,4,5,5,6) = 1,2,3,4,5,6,7
and a bounds checking bug unique to your formal spec because you only check inputs up to the length of the output
// first 0 elements of input must occur in output
SORT(1,2,3,4,5,5,6) = empty list
// first 6 elements of input must occur in output
SORT(1,2,3,4,5,5,6) = 1,2,3,4,5,7
- samus 2mo agoMy second condition would reject the additional element, as it would not be found in the input. have to be duplicated to However, I was lazy about the `|input| = |output|` constraints. With those constraints it would not be possible to omit elements from the input in the output.