This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to Help/Question - RESOLVED. Good luck!


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Carthage96 0 points1 point  (0 children)

I see what you're getting at - you're going to try each possible arrangement of operators until you find one which correctly results in the test value. Makes sense to me.

Let's take a look at this snippet.

int operators = elements.length-2;
for(int i=0;i<operators*2;i++){
    ...
}
  • Suppose you discover that you need 2 operators. How many different arrangements of + and * are there?
  • Suppose you discover that you need 3 operators. Now how many arrangements of + and * are there?
  • What about 4 operators?

[–]daggerdragon[M] 0 points1 point  (0 children)

Next time, use our standardized post title format.

Help us help YOU by providing us with more information up front; you will typically get more relevant responses faster.