Question: class FirstUnique: A data structure to efficiently track the first unique number in a stream of numbers. def _ _ init _
class FirstUnique:
A data structure to efficiently track the first unique number in a stream of
numbers."""
def initself nums:
Initialize the FirstUnique object with the numbers in the data stream.
:param nums: Listint A list of integers representing the data stream.
# TODO: Implement this method.
def addself number:
Add a new number to the data stream.
:param number: int The number to be added to the data stream.
# TODO: Implement this method.
def showFirstUniqueself:
Return the first unique number in the data stream.
If there is no such number, return
:return: int The first unique number, or if no unique number exists.
# TODO: Implement this method.
return
# NOTE: DO NOT MODIFY THE METHOD NAMES OR PARAMETERS.
# Your implementation will be autograded based on these method signatures.class FirstUnique:
A data structure to efficiently track the first unique number in a stream of
numbers."""
def initself nums:
Initialize the FirstUnique object with the numbers in the data stream.
:param nums: Listint A list of integers representing the data stream.
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
