Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def arrayPreviousLess(items)
- output = Array.new
- output[0] = -1
- x = 1
- y = 1
- while (x < items.length)
- z = x - 1
- while (z >= 0)
- if items[z] < items[x] then
- output[y] = items[z]
- break
- else
- output[y] = -1
- end
- z = z - 1
- end
- x = x + 1
- y = y + 1
- end
- return output
- end
Advertisement
Add Comment
Please, Sign In to add comment