Feeds
提问
Write a function nextinteger(v) which takes as input a vector v and as output returns the smallest positive integer which does not appear in v. For example, if the input is [1, 2, 3], the output would be 4. If the input is [4, 0, 1, -10], output =2
This funtion worked for the vector [1,2,3,4] but not for [4, 1, 0, -10] function [ ] = nextinteger(v) n = max(v); ...
8 years 前 | 2 个回答 | 0