Compare commits
No commits in common. "d3694c009a9cdcabeb25c1dfd0b7e6059ec4fa17" and "45adae9f25516bfa934f4e4a2531dda98a5f0274" have entirely different histories.
d3694c009a
...
45adae9f25
7
1512_number_of_good_pairs/Cargo.lock
generated
7
1512_number_of_good_pairs/Cargo.lock
generated
@ -1,7 +0,0 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
version = 4
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "number_of_good_pairs"
|
|
||||||
version = "0.1.0"
|
|
@ -1,6 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "number_of_good_pairs"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
@ -1,17 +0,0 @@
|
|||||||
pub struct Solution;
|
|
||||||
|
|
||||||
impl Solution {
|
|
||||||
pub fn num_identical_pairs(nums: Vec<i32>) -> i32 {
|
|
||||||
let mut result = 0;
|
|
||||||
|
|
||||||
for i in 0..nums.len() {
|
|
||||||
for j in (i + 1)..nums.len() {
|
|
||||||
if nums[i] == nums[j] {
|
|
||||||
result += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
version = 4
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "final_value_of_variable_after_performing_operations"
|
|
||||||
version = "0.1.0"
|
|
@ -1,6 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "final_value_of_variable_after_performing_operations"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
@ -1,17 +0,0 @@
|
|||||||
pub struct Solution;
|
|
||||||
|
|
||||||
impl Solution {
|
|
||||||
pub fn final_value_after_operations(operations: Vec<String>) -> i32 {
|
|
||||||
let mut result = 0;
|
|
||||||
|
|
||||||
for op in operations {
|
|
||||||
if op.contains('+') {
|
|
||||||
result += 1;
|
|
||||||
} else {
|
|
||||||
result -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user