add: description

This commit is contained in:
Lam Haoyin 2022-03-02 22:25:33 +08:00
parent bf1382494e
commit c19b115904
No known key found for this signature in database
GPG Key ID: 8C089CB1A2B7544F
2 changed files with 12 additions and 0 deletions

View File

@ -1,6 +1,12 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
/**
* 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 { class Solution {
private: private:
static inline constexpr unsigned long long diffULL(unsigned long long x, unsigned long long y) { static inline constexpr unsigned long long diffULL(unsigned long long x, unsigned long long y) {

View File

@ -1,5 +1,11 @@
#include <string> #include <string>
/**
* 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 { class Solution {
public: public:
static bool isSubsequence(const std::string& t, const std::string& s) { static bool isSubsequence(const std::string& t, const std::string& s) {