add: description [cpp]

This commit is contained in:
eat-swap 2022-04-17 13:07:41 +08:00
parent 9ac09a4f1d
commit 8e5e7c1d84
No known key found for this signature in database
GPG Key ID: 8C089CB1A2B7544F
2 changed files with 11 additions and 0 deletions

View File

@ -5,6 +5,12 @@
#include <algorithm> #include <algorithm>
#include <unordered_map> #include <unordered_map>
/**
* 819. Most Common Word
* Given a string paragraph and a string array of the banned words banned, return the most frequent word that is not banned. It is guaranteed there is at least one word that is not banned, and that the answer is unique.
* The words in paragraph are case-insensitive and the answer should be returned in lowercase.
*/
class Solution { class Solution {
public: public:
static std::string mostCommonWord(std::string paragraph, const std::vector<std::string>& banned) { static std::string mostCommonWord(std::string paragraph, const std::vector<std::string>& banned) {

View File

@ -8,6 +8,11 @@ struct TreeNode {
explicit TreeNode(int x = 0, TreeNode* l = nullptr, TreeNode* r = nullptr) : val(x), left(l), right(r) {} explicit TreeNode(int x = 0, TreeNode* l = nullptr, TreeNode* r = nullptr) : val(x), left(l), right(r) {}
}; };
/**
* 897. Increasing Order Search Tree
* Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child.
*/
class Solution { class Solution {
public: public:
static TreeNode* increasingBST(TreeNode* root, TreeNode* greater = nullptr) { static TreeNode* increasingBST(TreeNode* root, TreeNode* greater = nullptr) {