From b85bee25ded8d35eaea0b3aedfc5d0b77c40879e Mon Sep 17 00:00:00 2001 From: chayan das <110921638+Chayandas07@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:38:41 +0530 Subject: [PATCH] Create 2981. Find Longest Special Substring That Occurs Thrice I --- ...est Special Substring That Occurs Thrice I | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 2981. Find Longest Special Substring That Occurs Thrice I diff --git a/2981. Find Longest Special Substring That Occurs Thrice I b/2981. Find Longest Special Substring That Occurs Thrice I new file mode 100644 index 0000000..37d08c9 --- /dev/null +++ b/2981. Find Longest Special Substring That Occurs Thrice I @@ -0,0 +1,37 @@ +class Solution { +public: + int maximumLength(string s) { + mapmaps; + for( auto &a:s){ + maps[a]++; + } + bool test=false; + for(auto &a:maps){ + if(a.second>1) + test=true; + + } + if(test==false) + return -1; + int res=-1; + maptmp; + for(int i=0;i=3){ + int i=a.first.size(); + if(i>res){ + res=a.first.size(); + } + } + } + return res; +} +};