討論串[LeetCode] 刷到面試 Grind169 C++
共 14 篇文章
內容預覽:
232. Implement Queue using Stacks easy題. 這好簡單. 剛好開始的時候寫完. 趕緊來看. class MyQueue {. stack<int> in;. stack<int> out;. public:. MyQueue() {. }. void push(i
(還有435個字)
內容預覽:
141. Linked List Cycle easy題. 兩種解法 哈希表跟雙指針. 有趣. 哈希. class Solution {. public:. bool hasCycle(ListNode *head) {. unordered_set<ListNode*> visited;. whi
(還有407個字)
內容預覽:
110. Balanced Binary Tree easy題. 這題有偷看別人怎麼寫. 我好爛. class Solution {. public:. bool isBalanced(TreeNode* root) {. if(!root) return true;. bool balanced
(還有380個字)
內容預覽:
235. Lowest Common Ancestor of a Binary Search Tree easy題. 越來越熟練囉. class Solution {. public:. TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode*
(還有241個字)