20240117 Finished

This commit is contained in:
jackfiled 2024-01-17 10:48:46 +08:00
parent 16ae05efb7
commit 21be9f2c0f
2 changed files with 38 additions and 1 deletions

View File

@ -18,4 +18,5 @@ mod p2085_count_common_words_with_one_occurrence;
mod p2182_construct_string_with_repeat_limit;
mod p83_remove_duplicates_from_sorted_list;
mod p82_remove_duplicates_from_sorted_list_ii;
mod p2719_count_of_integers;
mod p2719_count_of_integers;
mod p2744_find_maximum_number_of_string_pairs;

View File

@ -0,0 +1,36 @@
/**
* [2744] Find Maximum Number of String Pairs
*/
pub struct Solution {}
// submission codes start here
impl Solution {
pub fn maximum_number_of_string_pairs(words: Vec<String>) -> i32 {
let mut result = 0;
for i in 0..words.len() {
let word: String = words[i].chars().rev().collect();
for j in (i + 1)..words.len() {
if word == words[j] {
result += 1;
}
}
}
result
}
}
// submission codes end
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_2744() {
}
}