question_slug
stringlengths
3
77
title
stringlengths
1
183
slug
stringlengths
12
45
summary
stringlengths
1
160
⌀
author
stringlengths
2
30
certification
stringclasses
2 values
created_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
updated_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
hit_count
int64
0
10.6M
has_video
bool
2 classes
content
stringlengths
4
576k
upvotes
int64
0
11.5k
downvotes
int64
0
358
tags
stringlengths
2
193
comments
int64
0
2.56k
calculate-digit-sum-of-a-string
python3 simple solution
python3-simple-solution-by-mxmb-c2ds
python\ndef digitSum(self, s: str, k: int) -> str:\n while len(s) > k:\n arr = [s[i:i+k] for i in range(0,len(s),k)] # divide \n ar
mxmb
NORMAL
2022-04-23T18:02:35.890528+00:00
2022-04-23T18:03:17.623646+00:00
156
false
```python\ndef digitSum(self, s: str, k: int) -> str:\n while len(s) > k:\n arr = [s[i:i+k] for i in range(0,len(s),k)] # divide \n arr = [str(sum(int(i) for i in s)) for s in arr] # replace\n s = \'\'.join(arr) # merge\n return s\n```
1
0
['Python', 'Python3']
0
calculate-digit-sum-of-a-string
C++ | 0ms Solution | Recursion with comments
c-0ms-solution-recursion-with-comments-b-ewr2
\nclass Solution {\npublic:\n string digitSum(string s, int k) {\n // if length is smaller or equal to k, no more rounds left\n if (s.length()
rohit2706
NORMAL
2022-04-21T13:28:47.861191+00:00
2022-04-21T13:28:47.861234+00:00
38
false
```\nclass Solution {\npublic:\n string digitSum(string s, int k) {\n // if length is smaller or equal to k, no more rounds left\n if (s.length() <= k)\n return s;\n \n // find string after this round\n string round_str;\n for (int i=0; i<s.length(); i+=k) {\n ...
1
0
[]
0
calculate-digit-sum-of-a-string
[Python] | Simple Simulation solution
python-simple-simulation-solution-by-gre-29di
This is my first post, so let\'s start with an easy one.\nWhat we want to do here is to simulate the rounds by iterating until our string s is shorter than k, a
gregalletti
NORMAL
2022-04-20T10:55:39.471003+00:00
2022-04-20T16:49:40.797272+00:00
118
false
*This is my first post, so let\'s start with an easy one.*\nWhat we want to do here is to **simulate the rounds** by iterating until our string `s` is shorter than `k`, and in the loop we:\n* split `s` in groups of length `k` and store the results in a list `groups`\n* calculate the sum of the digits of each group `g` ...
1
0
['Python', 'Python3']
0
calculate-digit-sum-of-a-string
Easy C++ Solution
easy-c-solution-by-shreya_2506-aaxx
class Solution {\npublic:\n string digitSum(string s, int k) {\n \n while(s.size()>k){\n \n int a=0,cnt=0;\n s
Shreya_2506
NORMAL
2022-04-20T06:32:15.375269+00:00
2022-04-20T06:32:15.375300+00:00
83
false
class Solution {\npublic:\n string digitSum(string s, int k) {\n \n while(s.size()>k){\n \n int a=0,cnt=0;\n string t="";\n \n for(int i=0;i<s.size();i++){\n \n a+=(s[i]-\'0\');\n cnt++;\n if(...
1
0
['String', 'C']
0
calculate-digit-sum-of-a-string
a few solutions
a-few-solutions-by-claytonjwong-l5lk
Recursively reduce the input string s into k-sized chunks.\n\n---\n\nKotlin\n\nclass Solution {\n fun digitSum(s: String, k: Int): String {\n var N =
claytonjwong
NORMAL
2022-04-19T15:45:21.174902+00:00
2022-04-19T15:48:03.044563+00:00
47
false
Recursively reduce the input string `s` into `k`-sized chunks.\n\n---\n\n*Kotlin*\n```\nclass Solution {\n fun digitSum(s: String, k: Int): String {\n var N = s.length\n if (N <= k)\n return s\n var f = { s: String -> s.toCharArray().map{ it.toInt() - \'0\'.toInt() }.sum()!! }\n ...
1
0
[]
0
calculate-digit-sum-of-a-string
Python || Easy Solution
python-easy-solution-by-nashvenn-7ix9
Please upvote if it helps. Thank you!\n\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n while len(s) > k:\n new_s = \'\'\n
nashvenn
NORMAL
2022-04-18T20:26:48.458671+00:00
2022-04-18T20:26:48.458712+00:00
66
false
**Please upvote if it helps. Thank you!**\n```\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n while len(s) > k:\n new_s = \'\'\n for i in range(0, len(s), k):\n new_s += str(sum([int(c) for c in s[i:i+k]]))\n s = new_s[:]\n return s\n```
1
0
['Python']
0
calculate-digit-sum-of-a-string
Python beats 100% memory 85% space | With Comments
python-beats-100-memory-85-space-with-co-3z5u
\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n \n # Requirement 3; Merge groups when string s > k\n while len(s) > k:\
krazynukz
NORMAL
2022-04-17T18:41:51.443134+00:00
2022-04-17T18:41:51.443182+00:00
88
false
```\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n \n # Requirement 3; Merge groups when string s > k\n while len(s) > k:\n temp = "" # Will contain the next round\'s string s\n i = 0 # counter to exit while loop below, when out of groups\n \n ...
1
0
['String', 'Python']
1
calculate-digit-sum-of-a-string
Short Python while loop
short-python-while-loop-by-hszh-kkgu
\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n \n while len(s) > k:\n curr = []\n for i in range(0, len
hsZh
NORMAL
2022-04-17T15:01:20.731836+00:00
2022-04-17T15:04:06.190380+00:00
40
false
```\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n \n while len(s) > k:\n curr = []\n for i in range(0, len(s), k):\n curr.append(str(sum(int(s[j]) for j in range(i, min(len(s),i+k)))))\n s = \'\'.join(curr)\n \n return ...
1
0
['Python']
0
calculate-digit-sum-of-a-string
✅ C++ | Easy to understand
c-easy-to-understand-by-rupam66-2pfu
\nclass Solution {\npublic:\n string digitSum(string s, int k) {\n if(s.size()<=1) return s;\n while(s.size()>k){\n string tmp;\n
rupam66
NORMAL
2022-04-17T14:09:55.296264+00:00
2022-04-17T14:09:55.296304+00:00
56
false
```\nclass Solution {\npublic:\n string digitSum(string s, int k) {\n if(s.size()<=1) return s;\n while(s.size()>k){\n string tmp;\n int num=0;\n for(int i=0;i<s.size();i++){\n if(i && i%k==0){\n tmp+=to_string(num);\n ...
1
0
['String', 'C']
0
calculate-digit-sum-of-a-string
5-Lines Python Solution || 100% Faster || Memory less than 85%
5-lines-python-solution-100-faster-memor-bwr7
\n\n\n### Solution: TC O((n/k)\n) / SC O(n)\n\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n while len(s)>k:\n tmp=\'\'\n
Taha-C
NORMAL
2022-04-17T14:06:40.417026+00:00
2022-04-17T14:41:10.528848+00:00
88
false
![image](https://assets.leetcode.com/users/images/7116de29-f9e8-4941-a72f-528d52cbef18_1650204904.767027.png)\n\n\n### ***Solution: TC O((n/k)\\*n) / SC O(n)***\n```\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n while len(s)>k:\n tmp=\'\'\n for i in range(0,len(s),k): t...
1
0
['Python', 'Python3']
0
calculate-digit-sum-of-a-string
Simple Python Solution
simple-python-solution-by-lcshiung-ix9k
\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n \n final_s = s\n while len(final_s) > k:\n new_s = \'\'
lcshiung
NORMAL
2022-04-17T13:37:39.820906+00:00
2022-04-17T17:19:15.599422+00:00
25
false
```\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n \n final_s = s\n while len(final_s) > k:\n new_s = \'\' # newly formed string\n k_length_sub_s = \'\' # k-length substring\n for i in range(len(final_s)):\n ...
1
0
[]
0
calculate-digit-sum-of-a-string
Java
java-by-ryann10-o1an
\nclass Solution {\n public String digitSum(String s, int k) {\n while (s.length() > k) {\n int groups = s.length() / k + (s.length() % k =
ryann10
NORMAL
2022-04-17T12:59:34.302437+00:00
2022-04-17T12:59:34.302465+00:00
70
false
```\nclass Solution {\n public String digitSum(String s, int k) {\n while (s.length() > k) {\n int groups = s.length() / k + (s.length() % k == 0 ? 0 : 1);\n \n StringBuilder sb = new StringBuilder();\n \n for (int i = 0; i < groups; i++) {\n ...
1
0
['String', 'Java']
0
calculate-digit-sum-of-a-string
Python | Recursive Solution | Easy to understand
python-recursive-solution-easy-to-unders-vozq
```\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n def util(s):\n\t\t\t# if length of s is less than or equal to k, then we can not m
parmardiwakar150
NORMAL
2022-04-17T12:23:45.641159+00:00
2022-04-17T12:25:57.604575+00:00
36
false
```\nclass Solution:\n def digitSum(self, s: str, k: int) -> str:\n def util(s):\n\t\t\t# if length of s is less than or equal to k, then we can not make s any shorter\n if len(s) <= k:\n return s\n ans = \'\'\n for i in range(0, len(s), k):\n ans...
1
0
['Recursion']
0
calculate-digit-sum-of-a-string
Simple Recursive Java Solution with comments
simple-recursive-java-solution-with-comm-4z8l
\nclass Solution {\n public String digitSum(String s, int k) {\n if (s.length() <= k) return s;\n \n StringBuilder sb = new StringBuilde
pure_aloha
NORMAL
2022-04-17T10:51:46.913716+00:00
2022-04-17T10:51:46.913756+00:00
45
false
```\nclass Solution {\n public String digitSum(String s, int k) {\n if (s.length() <= k) return s;\n \n StringBuilder sb = new StringBuilder();\n for (int i=0; i < s.length(); i += k) {\n int start = i;\n int end = Math.min(i + k, s.length()); // To avoid indexOutOfB...
1
0
['Recursion', 'Java']
1
find-maximum-number-of-string-pairs
Explained using map || Very simple & easy to understand solution
explained-using-map-very-simple-easy-to-j0ekd
Upvote if you like the solution\n# Approach\n1. Take a map with seen string as the index and its count as its value.\n2. Iterate the words vector and check if i
kreakEmp
NORMAL
2023-06-24T16:07:27.638358+00:00
2023-06-24T19:14:19.951377+00:00
4,159
false
#### Upvote if you like the solution\n# Approach\n1. Take a map with seen string as the index and its count as its value.\n2. Iterate the words vector and check if its reverse exist in the map or not. \n3. If exist in the map then update the ans and decrement the map value as the we have considered this value for pairi...
25
1
['C++']
4
find-maximum-number-of-string-pairs
676
676-by-votrubac-8zsx
There are 676 possible 2-character strings.\n\nSo, we use a boolean array to track if we\'ve seen a string before.\n\n> Note that we track reversed strings in t
votrubac
NORMAL
2023-06-24T16:20:11.653861+00:00
2024-06-18T21:41:57.687449+00:00
1,483
false
There are 676 possible 2-character strings.\n\nSo, we use a boolean array to track if we\'ve seen a string before.\n\n> Note that we track reversed strings in the boolean array. \n\n**C++**\n```cpp\nint maximumNumberOfStringPairs(vector<string>& words) {\n int vis[676] = {}, res = 0;\n for (const auto &w : words...
23
1
['C']
7
find-maximum-number-of-string-pairs
✅[Python] Simple and Clean, beats 88%✅
python-simple-and-clean-beats-88-by-_tan-14nq
Please upvote if you find this helpful. \u270C\n\n\n\n# Intuition\nThe problem asks us to find the maximum number of pairs that can be formed from a given list
_Tanmay
NORMAL
2023-07-05T09:54:04.927628+00:00
2023-07-05T09:54:04.927659+00:00
1,175
false
### Please upvote if you find this helpful. \u270C\n<img src="https://assets.leetcode.com/users/images/b8e25620-d320-420a-ae09-94c7453bd033_1678818986.7001078.jpeg" alt="Cute Robot - Stable diffusion" width="200"/>\n\n\n# Intuition\nThe problem asks us to find the maximum number of pairs that can be formed from a given...
15
0
['Array', 'Hash Table', 'String', 'Ordered Set', 'Python3']
5
find-maximum-number-of-string-pairs
[C++/JAVA/PYTHON] O(1) Space || Easy to Understand || With Explanation
cjavapython-o1-space-easy-to-understand-khcrl
Time complexity : O(n^2)\n- Space complexity : O(1)\n# C++ Code\n\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& v) {\n i
Aditya00
NORMAL
2023-06-24T16:15:24.571875+00:00
2023-06-24T18:22:04.297415+00:00
2,217
false
- Time complexity : O(n^2)\n- Space complexity : O(1)\n# C++ Code\n```\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& v) {\n int ans = 0; // Initialize the variable to store the answer\n int n = v.size(); \n\n // Iterate over all pairs of strings\n for (int i ...
15
1
['C++']
2
find-maximum-number-of-string-pairs
Python 3 || 3 lines, w/ explanation || T/S: 99% / 96% .
python-3-3-lines-w-explanation-ts-99-96-huga6
Here\'s how the code works:\n\nThe code initializesdto keep track of the count of each word or its reverse.\n\nWe iterate over each word inwords, and we use the
Spaulding_
NORMAL
2023-07-29T16:57:46.041055+00:00
2024-06-23T15:34:20.724193+00:00
1,035
false
Here\'s how the code works:\n\nThe code initializes`d`to keep track of the count of each word or its reverse.\n\nWe iterate over each word in`words`, and we use the lexicographic minimum of the word and its reverse (`word[::-1]`)as the key for loading `words` into `d`, which ensures that the same pair is counted only o...
9
0
['Python3']
0
find-maximum-number-of-string-pairs
Easy c++ solution using unordered set
easy-c-solution-using-unordered-set-by-r-z0v4
Intuition\n Describe your first thoughts on how to solve this problem. \nreverse and check the string is present in the set\n\n# Approach\n Describe your appr
rajgaurav95
NORMAL
2023-06-24T16:08:01.238133+00:00
2023-06-24T16:15:52.073323+00:00
1,862
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nreverse and check the string is present in the set\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\n\n- Space comple...
9
0
['C++']
2
find-maximum-number-of-string-pairs
🧩 [VIDEO] Maximum Number of String Pairs 🔀 - Reversed String Pairing
video-maximum-number-of-string-pairs-rev-qwzf
Intuition\nUpon reading the problem, it\'s apparent that we need to pair strings that are the reverse of each other. The first instinct is to use a data structu
vanAmsen
NORMAL
2023-07-25T21:50:53.116825+00:00
2023-07-25T22:06:57.504868+00:00
844
false
# Intuition\nUpon reading the problem, it\'s apparent that we need to pair strings that are the reverse of each other. The first instinct is to use a data structure that allows quick lookups to check for the existence of a reversed word. A Python dictionary fits this need perfectly.\n\nhttps://www.youtube.com/watch?v=z...
8
0
['C++', 'Java', 'Python3', 'JavaScript', 'C#']
1
find-maximum-number-of-string-pairs
How to be in top by time complexity
how-to-be-in-top-by-time-complexity-by-n-hej5
Code\n\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n total = 0\n c = set()\n for i in range(len(wo
NurzhanSultanov
NORMAL
2024-02-12T12:04:54.864126+00:00
2024-02-12T12:04:54.864168+00:00
415
false
# Code\n```\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n total = 0\n c = set()\n for i in range(len(words)):\n for j in range(i + 1, len(words)):\n word1 = words[i]\n word2 = words[j]\n\n if word1 == w...
6
0
['Python3']
1
find-maximum-number-of-string-pairs
✅Runtime 12 ms Beats 🚀100% and 💡Memory 13 MB Beats 📉99.67%
runtime-12-ms-beats-100-and-memory-13-mb-vtjt
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
deleted_user
NORMAL
2023-10-19T16:33:27.068540+00:00
2023-10-19T16:33:27.068570+00:00
263
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
6
0
['Python']
0
find-maximum-number-of-string-pairs
Java Solution || Using StringBuilder
java-solution-using-stringbuilder-by-ank-vjyz
Intuition\n Describe your first thoughts on how to solve this problem. \nWe have to find whether the reverse of a string at words[i] is present at index j such
Ankur_Chhillar
NORMAL
2023-07-08T15:15:16.909704+00:00
2023-07-08T15:15:16.909738+00:00
478
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe have to find whether the reverse of a string at words[i] is present at index j such that 0<=i<j<words.length and return the count of such pairs found.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nI have used ...
6
0
['Java']
1
find-maximum-number-of-string-pairs
Simple Java with Iterator
simple-java-with-iterator-by-dafteeer-hj7l
Approach\nI used Iterator and StringBuffer.reverse() for easy and simple solution.\n\n# Code\n\nclass Solution {\n public int maximumNumberOfStringPairs(Stri
dafteeer
NORMAL
2023-07-08T21:04:44.059144+00:00
2023-07-08T21:04:44.059166+00:00
662
false
# Approach\nI used Iterator and StringBuffer.reverse() for easy and simple solution.\n\n# Code\n```\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n List<String> wordsList = new ArrayList(Arrays.asList(words));\n int count = 0;\n for (Iterator<String> wordsIterator =...
5
0
['String', 'Iterator', 'Java']
1
find-maximum-number-of-string-pairs
Easy Python Solution
easy-python-solution-by-vistrit-qc01
Code\n\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n c=0\n for i in range(len(words)):\n for j
vistrit
NORMAL
2023-06-27T18:24:46.564103+00:00
2023-06-27T18:24:46.564132+00:00
976
false
# Code\n```\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n c=0\n for i in range(len(words)):\n for j in range(i+1,len(words)):\n if words[i]==words[j][::-1]:\n c+=1\n return c\n```
5
0
['Python3']
2
find-maximum-number-of-string-pairs
[C++] Set Vs. Hashing String to Int Vs. Bitmask Hashing, 4ms, 20.5MB
c-set-vs-hashing-string-to-int-vs-bitmas-eqck
Let\'s start with the simplest approach, which means we will use a hashset (seen) to keep track of already encountered strings.\n\nMore specifically, we will st
Ajna2
NORMAL
2023-06-24T20:39:20.946592+00:00
2023-06-24T20:39:20.946616+00:00
308
false
Let\'s start with the simplest approach, which means we will use a hashset (`seen`) to keep track of already encountered strings.\n\nMore specifically, we will start declaring:\n* `res` as our usual counter variable, initially set to be `0`;\n* `seen`, our set where we will store what we already saw (or its reverse, in...
5
0
['String', 'Bit Manipulation', 'Hash Function', 'Bitmask', 'C++']
1
find-maximum-number-of-string-pairs
Simple || Short || Clean || Java Solution
simple-short-clean-java-solution-by-hima-qrcj
\njava []\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n Map<String, Integer> map = new HashMap<>();\n for (Stri
HimanshuBhoir
NORMAL
2023-06-24T16:04:08.759853+00:00
2023-06-24T16:04:35.217089+00:00
2,007
false
\n```java []\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n Map<String, Integer> map = new HashMap<>();\n for (String s : words) {\n String rev = new StringBuilder(s).reverse().toString();\n if(map.containsKey(rev)) map.put(rev, map.get(rev)+1);\n...
5
1
['Java']
2
find-maximum-number-of-string-pairs
Best and simple java approach
best-and-simple-java-approach-by-venkate-9rvz
Code\njava []\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int ans=0;\n for(int i=0;i<words.length;i++) {\n
VenkateshThantapureddy
NORMAL
2024-09-07T09:15:56.647899+00:00
2024-09-07T09:15:56.647937+00:00
155
false
# Code\n```java []\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int ans=0;\n for(int i=0;i<words.length;i++) {\n \tfor(int j=i+1;j<words.length;j++) {\n \t\tif(words[i].charAt(0)==words[j].charAt(1) && words[i].charAt(1)==words[j].charAt(0)) \n \t\t...
4
0
['Java']
0
find-maximum-number-of-string-pairs
Good To Go ✅🚀
good-to-go-by-dixon_n-v7o0
\n# Code\njava []\n\n// This approcah is used to solve 2131. Longest Palindrome by Concatenating Two Letter Words\n\n\nclass Solution {\n public int maximumN
Dixon_N
NORMAL
2024-08-03T00:35:32.923307+00:00
2024-08-03T00:35:32.923339+00:00
473
false
\n# Code\n```java []\n\n// This approcah is used to solve 2131. Longest Palindrome by Concatenating Two Letter Words\n\n\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int ans = 0;\n HashMap<String, Integer> map = new HashMap<>();\n \n for (String w : words)...
4
0
['Hash Table', 'Java']
4
find-maximum-number-of-string-pairs
One line solution with Runtime 98%
one-line-solution-with-runtime-98-by-smd-3rdm
\n\n/**\n * @param {string[]} words\n * @return {number}\n */\nvar maximumNumberOfStringPairs = function(words) {\n return words.length - new Set(words.map((a)
smd_94
NORMAL
2023-11-13T20:44:04.765751+00:00
2023-11-13T20:44:04.765773+00:00
678
false
\n```\n/**\n * @param {string[]} words\n * @return {number}\n */\nvar maximumNumberOfStringPairs = function(words) {\n return words.length - new Set(words.map((a) => a[0]>a[1]? a[0]+a[1]: a[1]+a[0] )).size;\n};\n```
4
0
['JavaScript']
1
find-maximum-number-of-string-pairs
Easy Peasy
easy-peasy-by-ridamexe-3ofq
Code\n\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int count=0;\n int n=words.size();\n\n for
ridamexe
NORMAL
2023-06-25T13:41:52.677295+00:00
2023-06-25T13:41:52.677315+00:00
393
false
# Code\n```\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int count=0;\n int n=words.size();\n\n for(int i=0; i<n-1; i++){\n string s1=words[i];\n\n for(int j=i+1; j<n; j++){\n string s2=words[j];\n\n if...
4
0
['C++']
1
find-maximum-number-of-string-pairs
1 line using Set
1-line-using-set-by-bariscan97-r9s5
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Bariscan97
NORMAL
2023-06-24T23:54:56.667411+00:00
2023-06-24T23:54:56.667440+00:00
787
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
4
0
['Hash Table', 'Python', 'Python3']
2
find-maximum-number-of-string-pairs
Java || O(N) runtime, O(N) space || Scalable solution using StringBuilder.reverse()
java-on-runtime-on-space-scalable-soluti-fpe0
O(N) runtime due to iteration through words.\nO(N) space due to HashSet wordSet that may go up to N, the input words length.\n\nPairs are unique so removing fro
ZionWilliamson1
NORMAL
2023-06-24T16:23:51.857262+00:00
2023-06-24T16:23:51.857289+00:00
1,085
false
O(N) runtime due to iteration through `words`.\nO(N) space due to HashSet `wordSet` that may go up to N, the input `words` length.\n\nPairs are unique so removing from HashSet is never needed.\n```\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int maxPairs = 0;\n \n ...
4
0
['Java']
5
find-maximum-number-of-string-pairs
🔥MAP🔥||🔥C++🔥||🔥MOST SIMPLE🔥||🔥EASY TO UNDERSTAND🔥
mapcmost-simpleeasy-to-understand-by-gan-90r2
if this code helps you, please upvote\n# Code\n\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int ans = 0;\n
ganeshkumawat8740
NORMAL
2023-06-24T16:04:39.465737+00:00
2023-06-25T01:38:02.078879+00:00
803
false
# if this code helps you, please upvote\n# Code\n```\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int ans = 0;\n unordered_map<string,int> mp;\n string s;\n for(auto &i: words){\n s = i;\n reverse(s.begin(),s.end());\n ...
4
0
['Hash Table', 'String', 'String Matching', 'C++']
0
find-maximum-number-of-string-pairs
1 ms Beats 100.00% of users with Java
1-ms-beats-10000-of-users-with-java-by-h-a2gj
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
hojiakbarmadaminov45
NORMAL
2024-02-23T14:49:17.197847+00:00
2024-02-23T14:49:17.197875+00:00
288
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: 1ms \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: 41.40 mb\n<!-- Add your space complexity here, e...
3
0
['Java']
0
find-maximum-number-of-string-pairs
String Pairs - JavaScript - Beats 99.46 % ( 56 ms ) 🔥
string-pairs-javascript-beats-9946-56-ms-37is
\n\n1. Solution with two for loops\n\n/**\n * @param {string[]} words\n * @return {number}\n */\nvar maximumNumberOfStringPairs = function(words) {\n count =
zemamba
NORMAL
2023-06-26T20:03:52.920086+00:00
2023-06-26T23:49:41.039596+00:00
397
false
![image.png](https://assets.leetcode.com/users/images/5387b061-43d8-4eb2-ad68-62c894a3d6f3_1687823172.9767308.png)\n\n1. Solution with two for loops\n```\n/**\n * @param {string[]} words\n * @return {number}\n */\nvar maximumNumberOfStringPairs = function(words) {\n count = 0 \n\n for (let i = 0; i < words.length...
3
0
['Hash Table', 'JavaScript']
1
find-maximum-number-of-string-pairs
C++ -> Brute Force -> Set Solution [2 Solution]
c-brute-force-set-solution-2-solution-by-56w1
Intuition\nThink of reverse the each words of the given string and check if the reverse words available or not.\n\n---\n\n\n# Complexity\n- Time complexity:\n1.
amit24x
NORMAL
2023-06-24T17:08:30.976141+00:00
2023-06-24T17:08:30.976173+00:00
702
false
# Intuition\nThink of reverse the each words of the given string and check if the reverse words available or not.\n\n---\n\n\n# Complexity\n- Time complexity:\n1. *Brute Force:* **O(n^2)**\n2. *Set:* **O(n)**\n\n- Space complexity:**O(n)**\n\n---\n\n\n**Solution 1 - Brute Force**\n\n```\nclass Solution {\npublic:\n ...
3
0
['C++']
0
find-maximum-number-of-string-pairs
JavaScript simple solution with explanation
javascript-simple-solution-with-explanat-gqh1
Approach\n\n1. Initialize maxPairs to keep track of the maximum number of pairs\n2. Initialize wordSet to track words that can potentially form pairs\n3. Iterat
js_pro
NORMAL
2023-06-24T16:03:51.384912+00:00
2023-08-29T10:10:36.201827+00:00
408
false
# Approach\n\n1. Initialize `maxPairs` to keep track of the maximum number of pairs\n2. Initialize `wordSet` to track words that can potentially form pairs\n3. Iterate through the words:\n - sort the word lexicographically\n - checks if it is in `wordSet`\n - if found, a pair is formed, increment `maxPairs` an...
3
0
['JavaScript']
1
find-maximum-number-of-string-pairs
100% beat in java very easy code for beginners 😊.
100-beat-in-java-very-easy-code-for-begi-kmgn
Code
Galani_jenis
NORMAL
2025-01-07T12:43:08.929376+00:00
2025-01-07T12:43:08.929376+00:00
269
false
![94da60ee-7268-414c-b977-2403d3530840_1725903127.9303432.png](https://assets.leetcode.com/users/images/e13b2d25-1a97-4584-87df-979af55fed1d_1736253640.4995627.png) # Code ```java [] class Solution { public int maximumNumberOfStringPairs(String[] words) { int ans = 0; for (int i = 0; i < words.le...
2
0
['Java']
1
find-maximum-number-of-string-pairs
EASY C++ SOLUTION || 100% BEATS || 0 ms
easy-c-solution-100-beats-0-ms-by-yash_a-jxbu
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Yash_Akabari
NORMAL
2024-08-20T15:30:57.386323+00:00
2024-08-20T15:30:57.386369+00:00
97
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n- O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n- O(N)\n<!-- Add your space complexity here, ...
2
0
['Array', 'Hash Table', 'C++']
0
find-maximum-number-of-string-pairs
✅ One Line Solution
one-line-solution-by-mikposp-2avr
Code #1\nTime complexity: O(n). Space complexity: O(n).\n\nclass Solution:\n def maximumNumberOfStringPairs(self, w: List[str]) -> int:\n return len(w
MikPosp
NORMAL
2024-05-12T11:52:07.303409+00:00
2024-05-12T11:52:07.303443+00:00
140
false
# Code #1\nTime complexity: $$O(n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n def maximumNumberOfStringPairs(self, w: List[str]) -> int:\n return len(w)-len({*map(frozenset,w)})\n```\n\n# Code #2\nTime complexity: $$O(n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n def maximumNumberOf...
2
0
['Array', 'Hash Table', 'String', 'Simulation', 'Python', 'Python3']
0
find-maximum-number-of-string-pairs
[Java] Easy 100% solution
java-easy-100-solution-by-ytchouar-9e0p
java\nclass Solution {\n public int maximumNumberOfStringPairs(final String[] words) {\n int count = 0;\n\n for (int i = 0; i< words.length; i+
YTchouar
NORMAL
2024-05-05T04:08:50.605584+00:00
2024-05-05T04:08:50.605601+00:00
231
false
```java\nclass Solution {\n public int maximumNumberOfStringPairs(final String[] words) {\n int count = 0;\n\n for (int i = 0; i< words.length; i++)\n for(int j=i+1; j<words.length; j++)\n if(words[i].charAt(0) == words[j].charAt(1) && words[i].charAt(1) == words[j].charAt(0))...
2
0
['Java']
1
find-maximum-number-of-string-pairs
🔒 Use constraints to solve with vector of size 677 🔢
use-constraints-to-solve-with-vector-of-j22go
Intuition\nThe problem seems to involve counting pairs of words in a given list of strings. Each word in the list is potentially paired with its reverse. The ob
sambhav22435
NORMAL
2024-04-06T06:30:23.274279+00:00
2024-04-06T06:30:23.274307+00:00
97
false
# Intuition\nThe problem seems to involve counting pairs of words in a given list of strings. Each word in the list is potentially paired with its reverse. The objective is to find the maximum number of such pairs that can be formed.\n\n# Approach\n1. We\'ll iterate through the list of words, counting occurrences of ea...
2
0
['Array', 'Hash Table', 'Hash Function', 'C++']
0
find-maximum-number-of-string-pairs
Java || Simple string solution ♨️♨️
java-simple-string-solution-by-ritabrata-tara
\n\n# Code\n\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n List<String> list = new ArrayList<>();\n StringBuild
Ritabrata_1080
NORMAL
2023-11-03T18:37:13.768094+00:00
2023-11-03T18:37:13.768123+00:00
119
false
\n\n# Code\n```\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n List<String> list = new ArrayList<>();\n StringBuilder sb = new StringBuilder();\n int count = 0;\n for(String p : words){\n char c[] = p.toCharArray();\n if(c[0] != c[1]){\...
2
0
['String', 'Java']
0
find-maximum-number-of-string-pairs
100% and 78% beats | Java Solution
100-and-78-beats-java-solution-by-s_u_04-hofa
\nclass Solution \n{\n public int maximumNumberOfStringPairs(String[] words) \n {\n // creating a dic for each unique pair(26 * 26)\n boolea
S_U_04
NORMAL
2023-10-02T20:11:36.208835+00:00
2023-10-12T19:02:53.370126+00:00
496
false
```\nclass Solution \n{\n public int maximumNumberOfStringPairs(String[] words) \n {\n // creating a dic for each unique pair(26 * 26)\n boolean[] dictionary = new boolean[676];\n int count = 0;\n\n for (String w : words) \n {\n // current word index\n int ...
2
0
['Java']
0
find-maximum-number-of-string-pairs
Find Maximum Number Of String Pairs Solution in C++
find-maximum-number-of-string-pairs-solu-2n3q
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nUsing Unordered map\n#
The_Kunal_Singh
NORMAL
2023-09-15T18:08:13.615655+00:00
2023-09-15T18:08:13.615691+00:00
42
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nUsing Unordered map\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n^2)\n- Space complexity:\n<!-- Add your space complexi...
2
0
['C++']
0
find-maximum-number-of-string-pairs
Easy Java solution - Beats 100%
easy-java-solution-beats-100-by-karansid-tepv
We can use a nested for-loop to iterate through our \'words\' array and compare any two words in our array without worrying about it being counted as a duplicat
karansidz
NORMAL
2023-08-24T22:40:52.024645+00:00
2023-08-24T22:40:52.024665+00:00
148
false
We can use a nested for-loop to iterate through our \'words\' array and compare any two words in our array without worrying about it being counted as a duplicate (because the second for loop starts at \'i+1\' to ensure it can not be compared again). \n We can make use of String\'s charAt function to compare the char...
2
0
['Java']
0
find-maximum-number-of-string-pairs
Finding Maximum Number of String Pairs
finding-maximum-number-of-string-pairs-b-lj67
Intuition\n Describe your first thoughts on how to solve this problem. \nWHEN I SEE THIS PROBLEM: Find Maximum Number of (String Pairs)\n\n\n\n# Code\n\n\nclass
aadhiganapathy8
NORMAL
2023-08-16T11:59:54.131224+00:00
2023-08-16T11:59:54.131251+00:00
626
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWHEN I SEE THIS PROBLEM: Find Maximum Number of (String Pairs)\n![image.png](https://assets.leetcode.com/users/images/da4fa02d-8240-425d-9ee7-93b95966a1ed_1692186832.7186623.png)\n\n\n# Code\n```\n\nclass Solution {\n public int maximu...
2
0
['Array', 'Java']
1
find-maximum-number-of-string-pairs
Simple Solution using Hash map . Easy to understand for Beginners . Beats about 99 % .
simple-solution-using-hash-map-easy-to-u-xvjr
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
BinaryBrawler
NORMAL
2023-08-07T02:02:06.160134+00:00
2023-08-07T02:02:06.160162+00:00
622
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n![Screenshot from 2023-08-07 07-01-17.png](https://assets.leetcode.com/users...
2
0
['Python3']
1
find-maximum-number-of-string-pairs
Java || 1ms run:O(n) mem:O(1) || Boolean flags, No HashMap
java-1ms-runon-memo1-boolean-flags-no-ha-9paz
\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n boolean[] found = new boolean[26 * 26];\n int pairCount = 0;\n
dudeandcat
NORMAL
2023-08-02T07:10:16.223568+00:00
2023-08-02T07:10:16.223607+00:00
261
false
```\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n boolean[] found = new boolean[26 * 26];\n int pairCount = 0;\n for (String s : words) {\n if (found[(s.charAt(1) - \'a\') * 26 + s.charAt(0) - \'a\']) pairCount++;\n found[(s.charAt(0) - \'a\...
2
0
[]
1
find-maximum-number-of-string-pairs
Easy Approach
easy-approach-by-noor88-2qwq
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Noor88
NORMAL
2023-07-24T18:48:05.580157+00:00
2023-07-24T18:48:05.580178+00:00
163
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Java']
0
find-maximum-number-of-string-pairs
2 C++ solutions || Using hash-map and hash-set approach || Beats 100% !!
2-c-solutions-using-hash-map-and-hash-se-w7wc
Code\n\n// Soution 1 (HashMap)\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n unordered_map<string, int> mp;\n
prathams29
NORMAL
2023-07-19T09:19:26.712972+00:00
2023-07-19T09:19:26.713002+00:00
133
false
# Code\n```\n// Soution 1 (HashMap)\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n unordered_map<string, int> mp;\n int ans = 0;\n for(auto i : words){\n string rev = i;\n reverse(rev.begin(), rev.end());\n if(mp[rev] > 0)\...
2
0
['Hash Table', 'C++']
0
find-maximum-number-of-string-pairs
Easy c++ solution using linear search.
easy-c-solution-using-linear-search-by-j-y1pi
Intuition\n\n# Approach\nBrute Force Solution:\nUsing two loops firstly reverse the string of words and compare string of entire words.\n\n# Complexity\n- Time
jhasudarshan_07
NORMAL
2023-07-15T14:18:23.411509+00:00
2023-07-15T14:18:23.411537+00:00
288
false
# Intuition\n\n# Approach\nBrute Force Solution:\nUsing two loops firstly reverse the string of words and compare string of entire words.\n\n# Complexity\n- Time complexity:O(n^2)\n\n- Space complexity:O(n)\n\n# Code\n```\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n s...
2
0
['C++']
0
find-maximum-number-of-string-pairs
Q2744 Accepted C++ ✅ HashMap O(n) | Easiest Method
q2744-accepted-c-hashmap-on-easiest-meth-m3au
\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int n = words.size();\n int count = 0;\n unorder
adityasrathore
NORMAL
2023-07-09T10:07:33.492173+00:00
2023-07-09T10:07:33.492193+00:00
176
false
```\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int n = words.size();\n int count = 0;\n unordered_map <string,int> mp;\n for(int i=0;i<n;i++){\n if(words[i][0] > words[i][1]){\n swap(words[i][0],words[i][1]);\n ...
2
0
['C']
2
find-maximum-number-of-string-pairs
||EASY||SIMPLE||JAVA||
easysimplejava-by-himakshikohli-2b46
\n\n# Code\n\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int count =0;\n HashMap<String,Integer> arr = new Ha
himakshikohli
NORMAL
2023-07-08T13:15:46.546040+00:00
2023-07-08T13:15:46.546067+00:00
627
false
\n\n# Code\n```\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int count =0;\n HashMap<String,Integer> arr = new HashMap<>();\n\n for(int i=0 ;i<words.length;i++){\n String r = new StringBuilder(words[i]).reverse().toString();\n if(arr.contai...
2
0
['Java']
0
find-maximum-number-of-string-pairs
Most easy c++ ode
most-easy-c-ode-by-ayush07khurana-m0sh
Code\n\nclass Solution \n{\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int count=0;\n for(int i=0;i<words.size();i++)\
ayush07khurana
NORMAL
2023-06-27T11:20:36.891793+00:00
2023-06-27T11:20:36.891826+00:00
45
false
# Code\n```\nclass Solution \n{\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int count=0;\n for(int i=0;i<words.size();i++)\n {\n for(int j=i+1;j<words.size();j++)\n {\n string a=words[i];\n string b=words[j];\n ...
2
0
['Array', 'String', 'C++']
0
find-maximum-number-of-string-pairs
Python3 Solution
python3-solution-by-motaharozzaman1996-6cud
\n\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n ans = 0\n for i in range(len(words)):\n for j
Motaharozzaman1996
NORMAL
2023-06-25T01:12:29.831282+00:00
2023-06-25T01:12:29.831311+00:00
1,107
false
\n```\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n ans = 0\n for i in range(len(words)):\n for j in range(i+1, len(words)):\n if words[i][0] == words[j][1] and words[i][1] == words[j][0]:\n ans += 1\n return ans\...
2
0
['Python', 'Python3']
0
find-maximum-number-of-string-pairs
Easy Bruteforce
easy-bruteforce-by-deveshpatel11-v3oh
\nclass Solution {\n public static int maximumNumberOfStringPairs(String[] words) {\n int ans=0;\n for(int i=0;i<words.length;i++){\n
kanishkpatel1
NORMAL
2023-06-24T16:37:49.077426+00:00
2023-06-24T16:37:49.077445+00:00
1,114
false
```\nclass Solution {\n public static int maximumNumberOfStringPairs(String[] words) {\n int ans=0;\n for(int i=0;i<words.length;i++){\n for(int j=i+1;j<words.length;j++){\n if(words[i].equals(reverse(words[j]))){\n // System.out.println(words[i]);\n ...
2
0
['Array', 'Java']
0
find-maximum-number-of-string-pairs
[Python] easy using of set()
python-easy-using-of-set-by-pbelskiy-trqq
During this beweekly contest leetcode server is down again \uD83D\uDE2D\n\npython\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -
pbelskiy
NORMAL
2023-06-24T16:00:42.079119+00:00
2023-06-25T08:51:32.221297+00:00
87
false
During this beweekly contest leetcode server is down again \uD83D\uDE2D\n\n```python\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n v = set()\n \n for i in range(len(words)):\n for j in range(i + 1, len(words)):\n if words[i] == word...
2
1
[]
0
find-maximum-number-of-string-pairs
Simple Python Solution
simple-python-solution-by-ascending-3ccb
IntuitionApproachComplexity Time complexity: Space complexity: Code
ascending
NORMAL
2025-04-06T12:49:07.698723+00:00
2025-04-06T12:49:07.698723+00:00
10
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
1
0
['Python3']
0
find-maximum-number-of-string-pairs
Beats 100% C++ Solution, Using Set. T.C = O(n) & S.C = O(n).
beats-100-c-solution-using-set-tc-on-sc-u1aqk
IntuitionUse of Set (Unordered Set)ApproachIterate through the vector from start to finish, checking each element to see if its reverse exists in the set. If th
yugshah7777
NORMAL
2025-04-01T10:57:01.433667+00:00
2025-04-01T10:57:01.433667+00:00
24
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> Use of Set (Unordered Set) # Approach <!-- Describe your approach to solving the problem. --> Iterate through the vector from start to finish, checking each element to see if its reverse exists in the set. If the reversed string is found, i...
1
0
['C++']
0
find-maximum-number-of-string-pairs
EASY TO UNDERSTAND | BEGINNER FRIENDLY | 3ms Runtime | Beats 100% 🥷🏻🔥
easy-to-understand-beginner-friendly-3ms-36nu
IntuitionApproachComplexity Time complexity: Space complexity: Code
tyagideepti9
NORMAL
2025-03-25T17:01:54.937130+00:00
2025-03-25T17:01:54.937130+00:00
54
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
1
0
['Array', 'Hash Table', 'String', 'Simulation', 'Java', 'C#', 'MS SQL Server']
0
find-maximum-number-of-string-pairs
Simple Approach for beginners
simple-approach-for-beginners-by-srinath-rvga
IntuitionApproachComplexity Time complexity: Space complexity: Code
Srinath_Y
NORMAL
2025-02-14T15:08:39.724528+00:00
2025-02-14T15:08:39.724528+00:00
74
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
1
0
['String', 'Python']
0
find-maximum-number-of-string-pairs
Beginner Friendly | Solution with approach🐐 | 0ms Beats 100%
beginner-friendly-solution-with-approach-7jsy
IntuitionHere we will take use of unordered_set as by doing this we can do this problem in one pass with help of it, else it will take nested loops that's not t
ujjwalBuilds
NORMAL
2025-02-13T19:17:58.093721+00:00
2025-02-13T19:17:58.093721+00:00
79
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> Here we will take use of unordered_set as by doing this we can do this problem in one pass with help of it, else it will take nested loops that's not the perfect approach # Approach <!-- Describe your approach to solving the problem. --> 1...
1
0
['C++']
0
find-maximum-number-of-string-pairs
C++ solution using unordered set
c-solution-using-unordered-set-by-k_dadd-yfrp
Intuitionsets consists of unique elementsApproachtraverse on the vector, store the reverse of the element if reversed element is present in set => count++ else
k_daddyyy
NORMAL
2025-02-13T18:46:39.305643+00:00
2025-02-13T18:46:39.305643+00:00
52
false
# Intuition sets consists of unique elements # Approach traverse on the vector, store the reverse of the element if reversed element is present in set => count++ else insert that element into the set # Complexity - Time complexity: $$O(n)$$ - Space complexity: $$O(n)$$ # Code ```cpp [] class Solution { public: ...
1
0
['C++']
0
find-maximum-number-of-string-pairs
best and fast code
best-and-fast-code-by-diptanshu_888-zbaw
IntuitionApproachComplexity Time complexity: Space complexity: Code
diptanshu_888
NORMAL
2025-02-12T19:32:30.705173+00:00
2025-02-12T19:32:30.705173+00:00
98
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
1
0
['Array', 'Hash Table', 'String', 'Simulation', 'Java']
0
find-maximum-number-of-string-pairs
Runtime 2 ms Beats 70.40% Memory 17.55 MB Beats 78.50%
runtime-2-ms-beats-7040-memory-1755-mb-b-0w65
:):Code
ozodbek_bosimov
NORMAL
2025-02-07T12:38:59.824549+00:00
2025-02-07T12:38:59.824549+00:00
73
false
:): # Code ```python3 [] class Solution: def maximumNumberOfStringPairs(self, words: List[str]) -> int: ans = 0 n = len(words) for i in range(n): for j in range(i+1,n): if words[i][::-1] == words[j]: ans +=1 continue ...
1
0
['Python3']
0
find-maximum-number-of-string-pairs
Easy Solution with 100% beats in Java
easy-solution-with-100-beats-in-java-by-i1ilt
The problem is asking us to find the number of pairs of strings in the array words such that one string is the reverse of another. The brute-force approach woul
SANTHOSH_S_AIDS
NORMAL
2025-01-28T08:02:03.559198+00:00
2025-01-28T08:02:03.559198+00:00
166
false
The problem is asking us to find the number of pairs of strings in the array words such that one string is the reverse of another. The brute-force approach would involve checking every string and comparing it with the reversed form of every other string in the list. However, we can optimize this solution. Approach We ...
1
0
['Array', 'Java']
1
find-maximum-number-of-string-pairs
simple c++ code 👻
simple-c-code-by-varuntyagig-m52u
Complexity Time complexity: O(n2) Space complexity: O(1) Code
varuntyagig
NORMAL
2025-01-27T09:26:41.174990+00:00
2025-01-27T09:26:41.174990+00:00
63
false
![Screenshot 2025-01-27 at 2.54.58 PM.png](https://assets.leetcode.com/users/images/7cbb411f-cde4-4b5e-af20-5c3310200d57_1737969990.480203.png) # Complexity - Time complexity: $$O(n^2)$$ - Space complexity: $$O(1)$$ # Code ```cpp [] class Solution { public: int maximumNumberOfStringPairs(vector<string>& words) ...
1
0
['Array', 'String', 'Counting', 'C++']
0
find-maximum-number-of-string-pairs
Simple C Solution
simple-c-solution-by-mukesh1855-afpz
IntuitionApproach Write a function that takes two strings as paramter to check whether the two strings are palindrome or not. Then pass the two words to the fun
mukesh1855
NORMAL
2025-01-20T16:50:01.555165+00:00
2025-01-20T16:50:01.555165+00:00
22
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach - Write a function that takes two strings as paramter to check whether the two strings are palindrome or not. - Then pass the two words to the function to find the given string is palindrome, if it is palindrome then increase th...
1
0
['C']
0
find-maximum-number-of-string-pairs
Count Maximum Reversed String Pairs in an Array
count-maximum-reversed-string-pairs-in-a-5bff
IntuitionTo solve this problem, the main idea is to identify pairs of strings where one is the reverse of the other. Since the words array consists of distinct
aljo00
NORMAL
2025-01-17T04:13:41.534627+00:00
2025-01-17T04:13:41.534627+00:00
52
false
# Intuition To solve this problem, the main idea is to identify pairs of strings where one is the reverse of the other. Since the `words` array consists of distinct strings, we can safely check all possible pairs without worrying about duplicates. The most intuitive approach is to use two nested loops: 1. Fix one st...
1
0
['JavaScript']
1
find-maximum-number-of-string-pairs
Simple answer using HashSet
simple-answer-using-hashset-by-saksham_g-4q99
Complexity Time complexity: O(n.m) (n for loop and m for reverse) Space complexity: O(n+m) (n for Set and m for StringBuilder) Code
Saksham_Gupta_
NORMAL
2025-01-03T11:11:53.877446+00:00
2025-01-03T11:11:53.877446+00:00
83
false
<!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: ***O(n.m)*** (n for loop and m for reverse) <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: ***O(n+m)*** (n for Set and m for StringBuilder) <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Cod...
1
0
['Array', 'String', 'Java']
0
find-maximum-number-of-string-pairs
Find maximum number of string pairs -Easy solution for beginner -->
find-maximum-number-of-string-pairs-easy-vpu0
Intuition\n\n\n# Approach\nreversing the string and placing it in the words array and checking it with variable a.\n\n# Complexity\n- Time complexity:\n\n\n- Sp
Codeia
NORMAL
2024-08-27T00:55:55.563208+00:00
2024-08-27T00:55:55.563254+00:00
16
false
# Intuition\n\n\n# Approach\nreversing the string and placing it in the words array and checking it with variable a.\n\n# Complexity\n- Time complexity:\n\n\n- Space complexity:\n\n\n# Code\n```cpp []\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int c = 0;\n fo...
1
0
['C++']
0
find-maximum-number-of-string-pairs
Easy code
easy-code-by-shubhadip_009-g28w
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Shubhadip_009
NORMAL
2024-08-22T18:22:24.187609+00:00
2024-08-22T18:22:24.187680+00:00
133
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['C++']
0
find-maximum-number-of-string-pairs
two_loops_check _ki_iska reverse == other elemnt and yes count++
two_loops_check-_ki_iska-reverse-other-e-1npq
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
yesyesem
NORMAL
2024-08-22T17:19:20.272311+00:00
2024-08-22T17:19:20.272336+00:00
40
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['C++']
0
find-maximum-number-of-string-pairs
Beats 100%
beats-100-by-manyaagargg-jd0k
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
manyaagargg
NORMAL
2024-07-25T16:34:54.472637+00:00
2024-07-25T16:34:54.472668+00:00
10
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['C++']
0
find-maximum-number-of-string-pairs
Easy to Understand || Solution by Navyendhu Menon
easy-to-understand-solution-by-navyendhu-h0wd
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
navyendhummenon
NORMAL
2024-07-08T05:06:16.062519+00:00
2024-07-08T05:06:16.062550+00:00
7
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['JavaScript']
0
find-maximum-number-of-string-pairs
js solution🔥
js-solution-by-mhdsabeeh-zaby
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
MHDSabeeh
NORMAL
2024-05-04T07:27:49.688968+00:00
2024-05-04T07:27:49.689015+00:00
182
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['JavaScript']
0
find-maximum-number-of-string-pairs
Brute force + O(n) Hashmap solution
brute-force-on-hashmap-solution-by-jaime-ec9h
Brute Force\nSimple brute force method by computing the reverse of every single word and looking ahead the rest of the words to see if any of those match. This
jaimeloeuf
NORMAL
2024-04-11T13:13:19.810671+00:00
2024-04-11T13:13:19.810702+00:00
19
false
### Brute Force\nSimple brute force method by computing the reverse of every single word and looking ahead the rest of the words to see if any of those match. This has a TC of O(n^2) where n is the number of elements in `words`, and a SC of O(1).\n\n```typescript\nfunction maximumNumberOfStringPairs(words: string[]): n...
1
0
['Array', 'Hash Table', 'Simulation', 'TypeScript']
0
find-maximum-number-of-string-pairs
Simple java code 1 ms beats 100 % && 41 mb beats 89.25 %
simple-java-code-1-ms-beats-100-41-mb-be-pile
\n# Complexity\n- \n\n# Code\n\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int n = words.length;\n int count
Arobh
NORMAL
2024-01-23T04:27:44.701168+00:00
2024-01-23T04:27:44.701187+00:00
4
false
\n# Complexity\n- \n![image.png](https://assets.leetcode.com/users/images/779370d1-dcda-4e8d-b4d9-99e60ad5c61c_1705984027.4342566.png)\n# Code\n```\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int n = words.length;\n int count = 0;\n for (int i = 0; i < n; i++) {...
1
0
['Array', 'String', 'Simulation', 'Java']
0
find-maximum-number-of-string-pairs
Simple Solution
simple-solution-by-adhilalikappil-1prs
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
adhilalikappil
NORMAL
2024-01-20T04:53:27.573234+00:00
2024-01-20T04:53:27.573281+00:00
358
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['JavaScript']
0
find-maximum-number-of-string-pairs
C++ || HashSet
c-hashset-by-luisfrodriguezr-1ing
\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n unordered_set<string> hash_set;\n \n int ans = 0;\n for (au
ergodico
NORMAL
2024-01-19T19:44:00.165943+00:00
2024-01-19T19:44:00.165970+00:00
0
false
```\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n unordered_set<string> hash_set;\n \n int ans = 0;\n for (auto& word: words) {\n sort(begin(word), end(word));\n if (hash_set.find(word) != end(hash_set) ) {\n hash_set.erase(word);\n ans++;\n ...
1
0
[]
0
find-maximum-number-of-string-pairs
Easy solution || C++
easy-solution-c-by-garimapachori827-iv3y
Code\n\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int count=0;\n for(int i=0;i<words.size();i++){\n
garimapachori827
NORMAL
2023-12-13T16:16:55.983627+00:00
2023-12-13T16:16:55.983662+00:00
92
false
# Code\n```\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n int count=0;\n for(int i=0;i<words.size();i++){\n for(int j=i+1;j<words.size();j++){\n if(words[i]==palindrome(words[j])){\n count++;\n }\n ...
1
0
['Array', 'String', 'C++']
0
find-maximum-number-of-string-pairs
EASY C++ SOLUTION WITH MINIMAL CONCEPTS
easy-c-solution-with-minimal-concepts-by-405g
EASY C++ SOLUTION WITH MINIMAL CONCEPTS\n\n\n# Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to
codermal_
NORMAL
2023-11-08T13:13:52.462054+00:00
2023-11-08T13:13:52.462085+00:00
4
false
**EASY C++ SOLUTION WITH MINIMAL CONCEPTS**\n\n\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!--...
1
0
['C++']
0
find-maximum-number-of-string-pairs
Fcuk strrev
fcuk-strrev-by-parthapratimjana99-o9t7
Intuition\n Describe your first thoughts on how to solve this problem. \nstrlen(string_name)\treturns the length of string name.\n2)\tstrcpy(destination, source
parthapratimjana99
NORMAL
2023-10-08T07:52:45.214225+00:00
2023-10-08T07:52:45.214247+00:00
299
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nstrlen(string_name)\treturns the length of string name.\n2)\tstrcpy(destination, source)\tcopies the contents of source string to destination string.\n3)\tstrcat(first_string, second_string)\tconcats or joins first string with second stri...
1
0
['C']
1
find-maximum-number-of-string-pairs
JAVA SOLUTION || 100% FASTER || 1MS SOLUTION
java-solution-100-faster-1ms-solution-by-8wk9
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
viper_01
NORMAL
2023-09-06T11:40:05.971361+00:00
2023-09-06T11:40:05.971382+00:00
5
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['Java']
0
find-maximum-number-of-string-pairs
Beats 95.59% / 64.74%. The most simple js solution
beats-9559-6474-the-most-simple-js-solut-z9v0
\nvar maximumNumberOfStringPairs = function(words) {\n const set = new Set()\n let cnt = 0\n \n for (let word of words) {\n if (set.has(word.
tishka
NORMAL
2023-08-23T11:31:42.213235+00:00
2023-08-23T11:31:42.213262+00:00
80
false
```\nvar maximumNumberOfStringPairs = function(words) {\n const set = new Set()\n let cnt = 0\n \n for (let word of words) {\n if (set.has(word.split(\'\').reverse().join(\'\'))) cnt++\n \n set.add(word)\n }\n \n return cnt\n};\n```
1
0
['JavaScript']
1
find-maximum-number-of-string-pairs
Rust/Python Linear time/space with explanation
rustpython-linear-timespace-with-explana-iz8u
Intuition\nStore the counts of all strings in the hashmap. Now iterate over all our strings and find their reversed strings. Check if it exists in a hashmap. \n
salvadordali
NORMAL
2023-07-25T23:40:58.759144+00:00
2023-07-25T23:40:58.759192+00:00
45
false
# Intuition\nStore the counts of all strings in the hashmap. Now iterate over all our strings and find their reversed strings. Check if it exists in a hashmap. \n\nNow we have two possible options:\n - reverse string is equal to our original string. To be able to find a reverse we need to have at least two values in a ...
1
0
['Python3', 'Rust']
0
find-maximum-number-of-string-pairs
Java Easy to Understand Solution Using HashSet
java-easy-to-understand-solution-using-h-3iph
Code\n\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int count = 0;\n\t\tSet<String> ans = new HashSet<>();\n\t\tfor (
brothercode
NORMAL
2023-07-22T17:58:28.183301+00:00
2023-07-22T18:01:50.860433+00:00
5
false
# Code\n```\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n int count = 0;\n\t\tSet<String> ans = new HashSet<>();\n\t\tfor (String str : words) {\n\t\t\tchar ch[] = str.toCharArray();\n\t\t\tArrays.sort(ch); // Sort the Characters of each string.\n\t\t\tif (!ans.add(String.value...
1
0
['Java']
0
find-maximum-number-of-string-pairs
[JAVA] easy solution without StringBuilder/Map
java-easy-solution-without-stringbuilder-y18x
Intuition\n Describe your first thoughts on how to solve this problem. \nIn the entire array words count the number of times a word and its reverse is present i
Jugantar2020
NORMAL
2023-07-18T18:03:41.907219+00:00
2023-07-18T18:03:41.907244+00:00
370
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIn the entire array words count the number of times a word and its reverse is present in the array\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nfor all the words check if the first letter of a word equals the se...
1
0
['Array', 'String', 'Simulation', 'Java']
1
find-maximum-number-of-string-pairs
Kotlin 1 line
kotlin-1-line-by-georgcantor-iwp8
\nfun maximumNumberOfStringPairs(a: Array<String>) = a.groupingBy { it.toSortedSet() }.eachCount().count { it.value > 1 }\n
GeorgCantor
NORMAL
2023-07-16T10:58:51.919407+00:00
2023-07-16T12:19:55.416481+00:00
9
false
```\nfun maximumNumberOfStringPairs(a: Array<String>) = a.groupingBy { it.toSortedSet() }.eachCount().count { it.value > 1 }\n```
1
0
['Kotlin']
0
find-maximum-number-of-string-pairs
One line solution
one-line-solution-by-likils-gaul
Code\n\nclass Solution {\n func maximumNumberOfStringPairs(_ words: [String]) -> Int {\n return words.count - Set(words.map(Set.init)).count\n }\n}
likils
NORMAL
2023-07-14T07:55:08.488844+00:00
2023-07-14T07:55:08.488870+00:00
38
false
# Code\n```\nclass Solution {\n func maximumNumberOfStringPairs(_ words: [String]) -> Int {\n return words.count - Set(words.map(Set.init)).count\n }\n}\n```
1
0
['Swift']
1
find-maximum-number-of-string-pairs
Simple PHP solution
simple-php-solution-by-vlados117-ycah
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n\n# Code\n\nclass Solution {\n\n /**\n * @param String[] $words\n
Vlados117
NORMAL
2023-07-14T07:47:08.622600+00:00
2023-07-14T07:51:12.011558+00:00
15
false
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```\nclass Solution {\n\n /**\n * @param String[] $words\n * @return Integer\n */\n function maximumNumberOfStringPairs($words) {\n //Here we\'ll keep words as array keys\n $hash...
1
0
['PHP']
0
find-maximum-number-of-string-pairs
Java || Simple Solution ✅ || Rutime - 100% 💥 || Memory - 94% 💥 || With Explanation ✅
java-simple-solution-rutime-100-memory-9-ljni
Approach\n\n1. Initialize two variables: n to store the length of the words array and cnt to keep track of the count of valid pairs.\n2. Use nested loops to ite
akobirswe
NORMAL
2023-07-11T05:34:29.553852+00:00
2023-07-11T05:34:29.553869+00:00
379
false
# Approach\n\n1. Initialize two variables: `n` to store the length of the `words` array and `cnt` to keep track of the count of valid pairs.\n2. Use nested loops to iterate over all possible pairs of strings in the `words` array. The outer loop variable `i` represents the index of the first word, and the inner loop var...
1
0
['Array', 'String', 'Simulation', 'Java', 'C#']
0
find-maximum-number-of-string-pairs
C++ | Easy Solution Using Unordered Set
c-easy-solution-using-unordered-set-by-s-tx4j
Complexity\n- Time complexity: O(N)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(N)\n Add your space complexity here, e.g. O(n) \n\n# Co
shweta0098
NORMAL
2023-07-08T10:15:40.599402+00:00
2023-07-08T10:15:40.599428+00:00
17
false
# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n unordered_set<string> s;\n ...
1
0
['Hash Table', 'C++']
0
find-maximum-number-of-string-pairs
✅👌JAVA | 2 DIFFERENT APPROACH | EASY
java-2-different-approach-easy-by-dipesh-d691
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
dipesh_12
NORMAL
2023-07-07T14:46:33.593289+00:00
2023-07-07T14:46:33.593317+00:00
703
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['Java']
0
find-maximum-number-of-string-pairs
📌Solution with shift() method
solution-with-shift-method-by-m3f-smq1
Intuition\n Describe your first thoughts on how to solve this problem. \n1. Remove the first item from the array words and returns that removed item;\n2. Reverc
M3f
NORMAL
2023-06-29T11:34:53.198083+00:00
2023-06-29T11:34:53.198112+00:00
235
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n1. Remove the first `item` from the array `words` and returns that removed `item`;\n2. Reverce letters in removed `item`;\n3. Determine whether the array `words` includes a reverce `item` among its entries;\n4. Repeat until the array `wor...
1
0
['JavaScript']
0
find-maximum-number-of-string-pairs
[scala] - make pairs by indices, count
scala-make-pairs-by-indices-count-by-nik-2mwk
Code\n\nobject Solution {\n def maximumNumberOfStringPairs(words: Array[String]): Int = {\n val counts =\n words.indices.map { i =>\n val revers
nikiforo
NORMAL
2023-06-29T09:18:06.001054+00:00
2023-06-29T09:18:06.001087+00:00
16
false
# Code\n```\nobject Solution {\n def maximumNumberOfStringPairs(words: Array[String]): Int = {\n val counts =\n words.indices.map { i =>\n val reversed = words(i).reverse\n words.iterator.drop(i + 1).count(_ == reversed)\n }\n counts.sum\n }\n}\n```
1
0
['Scala']
0
find-maximum-number-of-string-pairs
JAVA | HashSet
java-hashset-by-sourin_bruh-k6iq
Solution:\n\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n Set<String> set = new HashSet<>();\n int cnt = 0;\n
sourin_bruh
NORMAL
2023-06-28T13:30:00.172784+00:00
2023-06-28T13:30:00.172818+00:00
223
false
# Solution:\n```\nclass Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n Set<String> set = new HashSet<>();\n int cnt = 0;\n for (String s : words) {\n StringBuilder sb = new StringBuilder(s).reverse();\n if (set.contains(sb.toString())) {\n ...
1
0
['Array', 'Hash Table', 'String', 'Java']
0