We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4688ceb commit 722f520Copy full SHA for 722f520
my-submissions/m1756 v1.py
@@ -0,0 +1,13 @@
1
+class MRUQueue:
2
+
3
+ def __init__(self, n: int):
4
+ self.q = list(range(1, n + 1))
5
6
+ def fetch(self, k: int) -> int:
7
+ self.q.append(self.q.pop(k - 1))
8
+ return self.q[-1]
9
10
11
+# Your MRUQueue object will be instantiated and called as such:
12
+# obj = MRUQueue(n)
13
+# param_1 = obj.fetch(k)
my-submissions/m1756.md
@@ -0,0 +1,4 @@
+### Version 1
+This version does not implement the followup to reduce the O(n) complexity of `fetch()`.
+This will require following up to adjust in the future.
0 commit comments