题目要求 We are given two sentences A and B.  (A sentence is a string of space separated words.  Each word consists only of lowercase letters.) A word is uncommon if it appears exactly once in one of the sentences, and does not appear in the other senten…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 字典统计 日期 题目地址:https://leetcode.com/problems/uncommon-words-from-two-sentences/description/ 题目描述 We are given two sentences A and B. (A sentence is a string of space separated wo…
We are given two sentences A and B.  (A sentence is a string of space separated words.  Each word consists only of lowercase letters.) A word is uncommon if it appears exactly once in one of the sentences, and does not appear in the other sentence. R…
题目标签:HashMap 题目给了我们两个句子,让我们找出不常见单词,只出现过一次的单词就是不常见单词. 把A 和 B 里的word 都存入 map,记录它们出现的次数.之后遍历map,把只出现过一次的存入 result. Java Solution: Runtime: 3 ms, faster than 89.90% Memory Usage: 37.2 MB, less than 85.88% 完成日期:03/27/2019 关键点:hashmap class Solution { publ…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 解题方法 递归 迭代 日期 题目地址:https://leetcode.com/problems/binary-tree-inorder-traversal/ 题目描述 Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 递归+队列 栈 日期 题目地址:https://leetcode.com/problems/flatten-nested-list-iterator/description/ 题目描述 Given a nested list of integers, implement an iterator to flatten it. Each element i…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 递归 迭代 日期 题目地址:https://leetcode.com/problems/n-ary-tree-preorder-traversal/description/ 题目描述 Given an n-ary tree, return the preorder traversal of its nodes' values. For example,…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 迭代 递归 日期 题目地址:https://leetcode.com/problems/reverse-linked-list-ii/description/ 题目描述 Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of…
problem 884. Uncommon Words from Two Sentences 题意:只要在两个句子中单词出现总次数大于1次即可. 注意掌握istringstream/map/set的使用方法. solution: class Solution { public: vector<string> uncommonFromSentences(string A, string B) { vector<string> res; unordered_map<string,…
[LeetCode]697. Degree of an Array 解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/degree-of-an-array/description/ 题目描述: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of…