From fdb841ae105d5c3162d892e3ed4b2d490fae7fc5 Mon Sep 17 00:00:00 2001 From: caixiangyue Date: Mon, 4 Sep 2023 16:04:53 +0800 Subject: [PATCH] add solusion --- 0142.h | 20 ++++++++++++++++++++ 0242.h | 24 ++++++++++++++++++++++++ common.h | 3 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 0142.h create mode 100644 0242.h diff --git a/0142.h b/0142.h new file mode 100644 index 0000000..651a97f --- /dev/null +++ b/0142.h @@ -0,0 +1,20 @@ +#include "common.h" + +using namespace std; + +namespace s0142 { + // Definition for singly-linked list. + struct ListNode { + int val; + ListNode *next; + ListNode() : val(0), next(nullptr) {} + ListNode(int x) : val(x), next(nullptr) {} + }; + class Solution { + public: + ListNode *detectCycle(ListNode *head) { + + + } + }; +} \ No newline at end of file diff --git a/0242.h b/0242.h new file mode 100644 index 0000000..5e77ae3 --- /dev/null +++ b/0242.h @@ -0,0 +1,24 @@ +#include "common.h" + +using namespace std; + +namespace s0242 { + + class Solution { +public: + bool isAnagram(string s, string t) { + int a[26]; + if (s.size() != t.size()) return false; + for (int i=0; i<26; i++) + a[i] = 0; + for (int i=0; i -#include \ No newline at end of file +#include +#include \ No newline at end of file