Discussion in 'OT Technology' started by s2k, Feb 22, 2010.
in c#, but the language shouldn't matter, i just need help figuring out the algorithm for solving it
is this for a job interview?
no its for class, but i've heard some companies uses it as a pre-interview "test"
Brute force it is the easy route.
Enumerate the available operators (including none) and iterate through every possible value that can be formed with those enumerations and the original digits.
But... if this was for a job interview the first thing you should determine, and ask if not apparent, is what the application of this would be to decide whether to optimize the solution for speed or memory footprint, as well as possible re-usability.
For example, you could construct a tree structure that would take a relatively long time to come up with a single answer, but after the tree is constructed in memory answering any similar subsequent question would be almost instantaneous (just a matter of parsing the tree and making a < or > determination at each node)
LOL I asked because I was just reading about job interview questions relevancy and then read this thread.