Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
You are given an array A = [a1; a2; a3; : : : ; an] of n positive integers. If you write the integers in the order they appear in A, and insert symbols + or before each integer, you get an arithmetic expression. If the evaluation of the expression gives the value v, we say that v is realized (or realizable) by the array A. For example, consider the array [7; 12; 1; 9; 5] of five positive integers. We have

What I have tried:

You are given an array A = [a1; a2; a3; : : : ; an] of n positive integers. If you write the integers in the order they appear in A, and insert symbols + or before each integer, you get an arithmetic expression. If the evaluation of the expression gives the value v, we say that v is realized (or realizable) by the array A. For example, consider the array [7; 12; 1; 9; 5] of five positive integers. We have
Posted
Updated 7-May-19 11:37am
v2
Comments
[no name] 6-May-19 13:45pm    
"Can anybody code this problem in java": Most probably yes. But why somebody here should do it?
F-ES Sitecore 6-May-19 13:50pm    
Thanks for the challenge, I just coded it up and it was fun!
#realJSOP 6-May-19 14:10pm    
Identifying the problem gets you half way to solving it.
Member 14057583 31-May-19 7:58am    
Can you please share your code here?thanks
F-ES Sitecore 31-May-19 8:03am    
I was only joking...

This is your homework, not ours. When do you plan on learning to actually code by yourself?

This forum isn't a homework service - this forum is for helping those who are really trying and have hit a snag. Not for lazy people who want things just given to them.

If you had planned on a career in computer programming, I suggest you find an alternative career as you've clearly no interest in the topic. Keep away from anything technical as they all pretty much require both desire and a great deal of effort. You clearly lack both.

Maybe work in a shop or a gas (petrol) station. Minimal study required. Whatever you choose, do yourself a favor and at least try to find something you like.
 
Share this answer
 
Comments
[no name] 6-May-19 15:55pm    
My small 5 as a little compensation
TheRealSteveJudge 7-May-19 3:12am    
Hard but true words. 5*
Manuele Camilletti 7-May-19 3:57am    
Clap Clap Clap
The problem requires the sum of the items of the array. What is wrong in a simple loop (see, for instance Iterating over Arrays in Java - GeeksforGeeks[^])?
 
Share this answer
 
Quote:
Can anybody code this problem in java

Most probably everyone here.
Quote:
I am new to Dynamic Programming and stuck somewhere, and could not figure out how to proceed further

As far as I can see, this requirement is not related to dynamic programming, but since you didn't post the complete text, I may be wrong.
To get help here, show your code and explain where you are stuck. By the way, complete the text of requirement.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900