Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions week8/akinola/consecutive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Consecutive
Have the function Consecutive(arr) take the array of integers stored in arr and return the minimum number of integers needed to make the contents of arr consecutive from the lowest number to the highest number. For example: If arr contains [4, 8, 6] then the output should be 2 because two numbers need to be added to the array (5 and 7) to make it a consecutive array of numbers from 4 to 8. Negative numbers may be entered as parameters and no array will have less than 2 elements.
8 changes: 8 additions & 0 deletions week8/akinola/consecutive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def Consecutive(arr):
l = range(min(arr),max(arr)+1)

# code goes here
return len(l)-len(arr)

# keep this function call here
print Consecutive(raw_input())