Skip to content

Commit bb098b5

Browse files
authored
Added solution for 2744
1 parent 7799083 commit bb098b5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
impl Solution {
2+
// Create nested loop to loop through words and compare every word with the reverse of every other word after it. Keep count of matches and return matches in the end
3+
pub fn maximum_number_of_string_pairs(words: Vec<String>) -> i32 {
4+
let size = words.len();
5+
let mut result = 0;
6+
7+
for i in 0..(size - 1) {
8+
for j in (i + 1)..size {
9+
if words[i] == words[j].chars().rev().collect::<String>() {
10+
result += 1;
11+
}
12+
}
13+
}
14+
return result;
15+
}
16+
}

0 commit comments

Comments
 (0)