This is the given brute force solution implemented in Java
public class Solution { int count = 0; public int findTargetSumWays(int[] nums, int S) {