We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Brackets can be understood as which one you calculate together. If you generate all possible sub-groups, the problem is same as not have brackets.
My approach was
GenerateCombinatations of give size(starting with 4) with given input (starting with all 10 digits)
We need to work on each of these but we can again use same method to generate more combinations of size 3. Then same method to generate more combination of size 2.
Perform all operations whenever you have group of size two, you get six possibilities:
a+b ,
a*b,
a-b ,
b-a ,
a/b ,
b/a,
you need to use floating point numbers.
Recombine the results, recalculated till group size reduces to 1. When are at a single answer at this to result set of the topLevelGroup.
Find max sequence number in each result set.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #93: Arithmetic expressions
You are viewing a single comment's thread. Return to all comments →
Brackets can be understood as which one you calculate together. If you generate all possible sub-groups, the problem is same as not have brackets.
My approach was
GenerateCombinatations of give size(starting with 4) with given input (starting with all 10 digits)
We need to work on each of these but we can again use same method to generate more combinations of size 3. Then same method to generate more combination of size 2.
Perform all operations whenever you have group of size two, you get six possibilities:
a+b , a*b, a-b , b-a , a/b , b/a,
you need to use floating point numbers. Recombine the results, recalculated till group size reduces to 1. When are at a single answer at this to result set of the topLevelGroup. Find max sequence number in each result set.