Skip to content

Commit

Permalink
d
Browse files Browse the repository at this point in the history
  • Loading branch information
tokomine committed Sep 17, 2023
1 parent 14e36bb commit 400efa2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
23 changes: 23 additions & 0 deletions LeetCode/2828.check-if-a-string-is-an-acronym-of-words.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "leetcode-definition.h"
/*
* @lc app=leetcode id=2828 lang=cpp
*
* [2828] Check if a String Is an Acronym of Words
*/

// @lc code=start
class Solution {
public:
bool isAcronym(vector<string>& words, string s) {
if (words.size() != s.size()) {
return false;
}
for (int i = 0; i < words.size(); i++) {
if (words[i][0] != s[i]) {
return false;
}
}
return true;
}
};
// @lc code=end
10 changes: 6 additions & 4 deletions LeetCode/leetcode-handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef LEETCODE_HANDLER
#define LEETCODE_HANDLER

#include "2833.furthest-point-from-origin.cpp"
#include "2828.check-if-a-string-is-an-acronym-of-words.cpp"
#include "leetcode-io.h"

namespace lc {
Expand All @@ -17,12 +17,14 @@ class Handler {
~Handler() { delete solution_; }
json::Json Handle(const json::Json& in, const std::string& fname) { return json::Create<json::JNull>(); }
void Handle(io::SI& in, io::MO& out) {
string moves;
in >> moves;
vector<string> words;
in >> words;
string s;
in >> s;
#ifdef LAZY_INTERACTION
in.Input(LAZY_INTERACTION);
#endif
out << solution_->furthestDistanceFromOrigin(moves) << std::endl;
out << solution_->isAcronym(words, s) << std::endl;
}

private:
Expand Down

0 comments on commit 400efa2

Please sign in to comment.