int showFirstUnique()returns the value of the first unique integer of the queue, and returns -1 if there is no such integer. void add(int value)insert value to the queue. Example 1: Input: ["FirstUnique","showFirstUnique","add","showFirstUnique","add","showFirstUnique","add","show...
7. Pattern: Tree Breadth First Search,树上的BFS 这种模式基于宽搜(Breadth First Search (BFS)),适用于需要遍历一颗树。借助于队列数据结构,从而能保证树的节点按照他们的层数打印出来。打印完当前层所有元素,才能执行到下一层。所有这种需要遍历树且需要一层一层遍历的问题,都能用这种模式高效解决。 这种树上...
First Unique Number Leetcode 54. Spiral Matrix Leetcode 362. Design Hit Counter Stack题目: Leetcode 155. Min Stack (follow up Leetcode 716 Max Stack) Leetcode 232. Implement Queue using Stacks Leetcode 150. Evaluate Reverse Polish Notation Leetcode 224. Basic Calculator II (I, II, III, I...
1429 First Unique Number 47.0% Medium 1430 Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree 44.8% Medium 1431 Kids With the Greatest Number of Candies 88.9% Easy 1432 Max Difference You Can Get From Changing an Integer 42.8% Medium 1433 Check If a ...
1429-First-Unique-Number/cpp-1429 1430-Check-If-a-String-Is-a-Valid-Sequence-from-Root-to-Leaves-Path-in-a-Binary-Tree/cpp-1430 1431-Kids-With-the-Greatest-Number-of-Candies/cpp-1431 1432-Max-Difference-You-Can-Get-From-Changing-an-Integer/cpp-1432 1433-Check-If-a-String-Can-Break...
1429 First Unique Number (M) 1500 1469 Find All The Lonely Nodes (E) 900 1474 Delete N Nodes After M Nodes of a Linked Lists (E) 1000 1485 Clone Binary Tree With Random Pointer (M) 1500 1506 Find Root of N-Ary Tree (M-) 1300 1522 Diameter of N-Ary Tree (M-) 1300 1554 Strin...
1429-First-Unique-Number 1430-Check-If-a-String-Is-a-Valid-Sequence-from-Root-to-Leaves-Path-in-a-Binary-Tree 1431-Kids-With-the-Greatest-Number-of-Candies 1432-Max-Difference-You-Can-Get-From-Changing-an-Integer 1433-Check-If-a-String-Can-Break-Another-String 1434-Number-of-Ways-to-W...
Leetcode 264. Ugly Number II Leetcode 88. Merge Sorted Arrays Leetcode 692. Top K Frequent Words Leetcode 378. Kth Smallest Element in a Sorted Matrix Leetcode 295. Find Median from Data Stream(标准解法是双heap,但是SortedDict会非常容易) ...
Leetcode 1429. First Unique Number Leetcode 54. Spiral Matrix Leetcode 362. Design Hit Counter Stack题目: Leetcode 232. Implement Queue using Stacks Leetcode 150. Evaluate Reverse Polish Notation Leetcode 224. Basic Calculator II (I, II, III, IV) Leetcode 20. Valid Parentheses Leetcode 147...
1429 First Unique Number 🔒 Medium NaN NaN NaN NaN 1691 Maximum Height by Stacking Cuboids Hard NaN NaN NaN NaN 1247 Minimum Swaps to Make Strings Equal Medium NaN NaN NaN NaN 1248 Count Number of Nice Subarrays Medium NaN NaN NaN NaN 1249 Minimum Remove to Make Valid Parentheses Medium ...