1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! 🔗 Two Pointers (Generic)
//!
//! Finds two indices such that their values sum to a target (for sorted slices).
//!
//! # Type Parameters
//! * `T`: The element type. Must implement `Ord + Copy + std::ops::Add<Output = T>`.
//!
//! # Arguments
//! * `slice` - The sorted slice to search.
//! * `target` - The target sum.
//!
//! # Returns
//! * `Option<(usize, usize)>` - The indices of the two elements, or None if not found.
//!
//! # Example
//! ```rust
//! use pofk_algorithm::list_algorithms::two_pointers_sum;
//! let arr = [1, 2, 3, 4, 6];
//! assert_eq!(two_pointers_sum(&arr, 6), Some((1, 3)));
//! ```