Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
missing element
--lua 5.3 A = {1,2,4,5} function printa(va) for i,v in ipairs(va) do io.write(v, ' ') end io.write('\n') end printa(A) function sum(va) local acc = 0 for i,v in ipairs(va) do acc = acc + v end return acc end function missing(va) local n = #va local lim = (n * (n + 1)) / 2 local t = sum(va) if(t == lim) then return -1 end print(lim) return (lim + va[#va]) - t end print(missing(A))
run
|
edit
|
history
|
help
0
Non-Lua core for new scripting languages (Beta)
Properties in Lua
quick sort
Newton-Raphson method for the square root
xml panel repeater
PAID HACK PuBG
cumulative probability
sh
True every 5
example for a friend