Phillip Small

Greenhorn
+ Follow
since Nov 07, 2018
Cows and Likes
Cows
Total received
2
In last 30 days
1
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Phillip Small

That makes logical sense.  You make it sound easy.  This thing is killing me.  Thanks for your assistance.  Maybe, I should just start over.  
1 month ago
I self-corrected my statement in a reply right after that.  My mistake.  you are absolutely correct.  Thanks for the catch.  
1 month ago
Yes Junilu.  basically, I am trying to figure out how to get the position.  the code will loop through and find the correct value based on the values in the array.  
1 month ago
This seems like I will have to rewrite most of it.  Is there any quicker way so that I can change what is printed?  The position rather than the value? I assumed that the change would be in this line-

System.out.println("sum("+Arrays.toString(partial.toArray())+")="+target);

But I guess it is not that simple.  Regarding streams, would I add that at the end of the previous code?  I am confused by this.  System.out.printf("Sum = %d%n", List.of(5, 5, 10, 15)
                                   .stream()
                                   .mapToInt(i -> i.intValue())
                                   .sum());
1 month ago
I have some code that prints out the summary of a given array but want to know how to print the position rather than the value inside the sum?




The current output is:

sum([5, 10])=15
sum([5, 10])=15
sum([15])=15


I am trying to figure out how to get the output to print the position of the array:

sum([3]) = 15
sum([0,3)] = 15
sum([1,3)]=15
1 month ago