20240117 Finished
This commit is contained in:
parent
16ae05efb7
commit
21be9f2c0f
|
@ -19,3 +19,4 @@ 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 p2744_find_maximum_number_of_string_pairs;
|
36
src/problem/p2744_find_maximum_number_of_string_pairs.rs
Normal file
36
src/problem/p2744_find_maximum_number_of_string_pairs.rs
Normal 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() {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user