add: 220305-CN [cpp]

This commit is contained in:
Lam Haoyin 2022-03-05 13:39:13 +08:00
parent fa8c94af11
commit 1743eb1ab3
No known key found for this signature in database
GPG Key ID: 8C089CB1A2B7544F
2 changed files with 16 additions and 1 deletions

15
cpp/2203/220305-CN.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <string>
#include <iostream>
class Solution {
public:
// clang does not accept constexpr
static inline int findLUSlength(const std::string& a, const std::string& b) {
return a == b ? -1 : static_cast<int>(std::max(a.length(), b.length()));
}
};
int main() {
std::cout << Solution::findLUSlength("aaa", "bbb");
return 0;
}

View File

@ -3,4 +3,4 @@ PROJECT(2203)
SET(CMAKE_CXX_STANDARD 23)
ADD_EXECUTABLE(2203 220304.cpp)
ADD_EXECUTABLE(2203 220305-CN.cpp)