Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@VeldaKiara
VeldaKiara / queues.py
Created September 1, 2021 08:48
Queues
# Queue implementation
class Queue:
def __init__(self):
self.queue = []
# Add an element
def enqueue(self, item):
self.queue.append(item)
@VeldaKiara
VeldaKiara / Algorithms Friday #1
Created April 10, 2021 05:57
This is a list of the algorithms I will be solving.
nums = [0, 0, 1, 1, 2, 2, 3, 3, 4]
#using list comprehension to remove duplicates
non_dup = []
[non_dup.append(x) for x in nums if x not in non_dup]
print(str(non_dup))
print(len(non_dup))