Skip to content

Commit 92ad82f

Browse files
add 1756
1 parent 71c056e commit 92ad82f

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ _If you like this project, please leave me a star._ ★
1717
|1763|[Longest Nice Substring](https://leetcode.com/problems/longest-nice-substring/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1763.java) ||Easy|String|
1818
|1759|[Count Number of Homogenous Substrings](https://leetcode.com/problems/count-number-of-homogenous-substrings/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1758.java) ||Medium|String ,Greedy|
1919
|1758|[Minimum Changes To Make Alternating Binary String](https://leetcode.com/problems/minimum-changes-to-make-alternating-binary-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1758.java) ||Easy|Greedy, Array|
20+
|1756|[Design Most Recently Used Queue](https://leetcode.com/problems/design-most-recently-used-queue/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1756.java) ||Medium|Array, Design, Dequeue|
2021
|1754|[Largest Merge Of Two Strings](https://leetcode.com/problems/largest-merge-of-two-strings/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1753.java) ||Medium|Greedy, Suffix Array|
2122
|1753|[Maximum Score From Removing Stones](https://leetcode.com/problems/maximum-score-from-removing-stones/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1753.java) ||Medium|Math, Heap|
2223
|1752|[Check if Array Is Sorted and Rotated](https://leetcode.com/problems/check-if-array-is-sorted-and-rotated/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1752.java) ||Easy|Array|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.fishercoder.solutions;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class _1756 {
7+
public static class Solution1 {
8+
class MRUQueue {
9+
List<Integer> list;
10+
11+
public MRUQueue(int n) {
12+
list = new ArrayList(n);
13+
for (int i = 1; i <= n; i++) {
14+
list.add(i);
15+
}
16+
}
17+
18+
public int fetch(int k) {
19+
int fetched = list.remove(k - 1);
20+
list.add(fetched);
21+
return fetched;
22+
}
23+
}
24+
25+
}
26+
}

0 commit comments

Comments
 (0)