You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 0494-target-sum.rs
    path of file: ./repos/NeetCode-Solutions/14_2-D_Dynamic_Programming/05_Target_Sum
    
    the code of the file until where you have to start completion: /*
Problem: LeetCode 494 - Target Sum

Key Idea:
The key idea is to use dynamic programming to count the number of ways to achieve a target sum using the given positive and negative numbers.

Approach:
1. Initialize a variable `sum` to store the sum of all elements in the input array `nums`.
2. Calculate the target sum `target` as the difference between the `sum` and the given `S`.
3. Check if `target` is odd or negative. If it is, there are 
    
    pub fn find_target_sum_ways(nums: Vec<i32>, s: i32) -> i32 {
        let sum: i32 = nums.iter().sum();
        let target = sum - s;

        if target < 0 || target % 2 != 0 {
            return 0;
        }

        let target = (target / 2) as usize;
        let mut dp = vec![0; target + 1];
        dp[0] = 1;

        for num in nums {
            for i in (num as usize..=target).rev() {
                dp[i] += dp[i - num as usize];
            }
        }

        dp[target]
    }