Anyone know a smart way to find the first available number in at array like this : [1, 2, 3, 5, 6, 7].
I would like to get the result 4 or [1,2,3,4] the result will be 5 or [2,3,4,5] the result will be 1
dim ar() as int
ar(0)=1:ar(1)=2:ar(2)=3:ar(3)=5:ar(4)=6:ar(5)=7
n=ar.size
dim s1,s2 as int
s1=(n+1)*(n+2)/2
s2=0
for k=0 to n-1
s2=s2+ar(k)
next
msgbox(s1-s2,"you mean this?")
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.