How would you solve a simple LeetCode-style array problem using loops and pointers, including a two-pointer approach?