From c19b1159047f66e24d7cdcd5c5053e9dcd84a041 Mon Sep 17 00:00:00 2001 From: Lam Haoyin Date: Wed, 2 Mar 2022 22:25:33 +0800 Subject: [PATCH] add: description --- cpp/2203/220302-CN.cpp | 6 ++++++ cpp/2203/220302.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/cpp/2203/220302-CN.cpp b/cpp/2203/220302-CN.cpp index dc28c8d..f52b4ae 100644 --- a/cpp/2203/220302-CN.cpp +++ b/cpp/2203/220302-CN.cpp @@ -1,6 +1,12 @@ #include #include +/** + * 564. Find the Closest Palindrome + * Given a string n representing an integer, return the closest integer (not including itself), which is a palindrome. If there is a tie, return the smaller one. + * The closest is defined as the absolute difference minimized between two integers. + */ + class Solution { private: static inline constexpr unsigned long long diffULL(unsigned long long x, unsigned long long y) { diff --git a/cpp/2203/220302.cpp b/cpp/2203/220302.cpp index 5ad7c87..244e6dd 100644 --- a/cpp/2203/220302.cpp +++ b/cpp/2203/220302.cpp @@ -1,5 +1,11 @@ #include +/** + * 392. Is Subsequence + * Given two strings s and t, return true if s is a subsequence of t, or false otherwise. + * A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not). + */ + class Solution { public: static bool isSubsequence(const std::string& t, const std::string& s) {