Question: This is my code so far but I am getting error: def remove _ duplicates ( arr: StaticArray ) - > StaticArray: if arr.length (
This is my code so far but I am getting error: def removeduplicatesarr: StaticArray StaticArray:
if arr.length:
return arr
resultsize
currentvalue arr.get
for i in range arr.length:
if arr.geti currentvalue:
# If the current element is different from the previous one, add it to the result array
arr.setresultsize, arr.geti
resultsize
currentvalue arr.geti
# Create a new StaticArray with the unique elements
resultarr StaticArrayresultsize
for i in rangeresultsize:
resultarr.seti arr.geti
return resultarr This the error: Remove Duplicates Test
Description : This is the same test as in PDF Example
Input : STATARR Size:
Expected : STATARR Size:
Student : STATARR Size:
ERROR: Original array was modified
Modified Input: STATARR Size:
Test Failed: False is not true
Remove Duplicates Test
Description : Testing with an array of random values
Input : STATARR Size:
Expected : STATARR Size:
Student : STATARR Size:
ERROR: Original array was modified
Modified Input: STATARR Size: Please Help!!!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
