Question: sa _ range ( start: int, end: int ) - > StaticArray: Write a function that receives the two integers start and end, and returns

sa_range(start: int, end: int)-> StaticArray:
Write a function that receives the two integers start and end, and returns a StaticArray that
contains all the consecutive integers between start and end (inclusive).
For full credit, the function must be implemented with O(N) complexity.
Example #1:
cases =[
(1,3),(-1,2),(0,0),(0,-3),
(-95,-89),(-89,-95)
]
for start, end in cases:
print(fStart: {start: 4}, End: {end: 4},{sa_range(start, end)})
Output:
Start: 1, End: 3, STAT_ARR Size: 3[1,2,3]
Start: -1, End: 2, STAT_ARR Size: 4[-1,0,1,2]
Start: 0, End: 0, STAT_ARR Size: 1[0]
Start: 0, End: -3, STAT_ARR Size: 4[0,-1,-2,-3]
Start: -95, End: -89, STAT_ARR Size: 7[-95,-94,-93,-92,-91,-90,-89]
Start: -89, End: -95, STAT_ARR Size: 7[-89,-90,-91,-92,-93,-94,-95] RESTRICTIONS: You are NOT allowed to use ANY built-in Python data structures and/or their methods in any of your solutions. This includes built-in Python lists, dictionaries, or anything else. Variables to hold a single value or a tuple holding two/three values are allowed. It is OK to use built-in Python generator functions like range(). You are NOT allowed to directly access any variables of the StaticArray class (like self._size or self._data). All work must be done by using the StaticArray class methods.
You may not use any imports beyond the ones included in the assignment source code. Code must start with def sa_range(start: int, end: int)-> StaticArray:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!