Question: I need to solution for this one. I'm having trouble with it: Please read the following carefully: You cannot use python lists in your solution;
I need to solution for this one. I'm having trouble with it: Please read the following carefully:
You cannot use python lists in your solution; only StaticArrays.
A StaticArray is an ADT with only 3 methods: StaticArray.get(item), StaticArray.set(index, item), StaticArray.size(). Important: You must specify the size of the StaticArray when initializing it. Example: StaticArray(6) is a size 6 StaticArray.
def sa_intersection(arr1: StaticArray, arr2: StaticArray, arr3: StaticArray) -> StaticArray: """ Returns a new StaticArray only with the elements that appear in *arr1*, *arr2*, *arr3*.
"""
python code here
Testing Code:
Input : [1, 1, 2, 2, 5, 75], [1, 2, 2, 12, 75, 90], [-5, 2, 2, 2, 20, 75, 95] Expected : [2, 2, 75]
Input : [-8, -7, -4, -1, 2, 6, 10], [-9, -8, -7, -7, -6, -2, 1, 9], [-9, -7, 1, 8, 9] Expected : [-7]
Write a function that receives three StaticArrays where the elements are already in sorted order and returns a new StaticArray only with those elements that appear in all three input arrays. Original arrays should not be modified. If there are no elements that appear in all three input arrays, return a StaticArray with a single None element in it. You may assume that values stored in the input arrays are all of the same type (either all numbers, or strings, or custom objects, but never a mix of those) and that elements of the input arrays already are in the non-descending sorted order. You do not need to write checks for these conditions. For an additional challenge, try implementing a solution with O(N) runtime complexity, where N is the total number of elements in all input arrays
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

You cannot use python lists in your solution; only StaticArrays.