Hi,
I need to generate digit sequences from a number.
Give N= 2034
int[] s = reverseDigit(N); // s[] = {2, 0, 3, 4};
Now, I need to generate the following set numbers
S1 = {2, 0, 3, 4}
s2 = {2, 0, 34}
s3 = {2, 034} // not acceptable
s4 = {20, 3, 4}
s5 = {20, 34}
s6 = {203, 4}
s7 = {2034}
I tried, but could not write the code.
Thank you very much for assistance.
-- Amir
On Thu, Nov 15, 2012 at 10:47 AM, Tanuj Khattar <[email protected]>wrote:
> U can try breaking the given no nd storing the individual digits in an
> array /vector using the "reversing a digit" algorithm and then carry out
> further computations on the individual digits...
> On Nov 15, 2012 9:06 PM, "Amir Hossein Sharifzadeh" <
> [email protected]> wrote:
>
>> Hi,
>>
>> Suppose we have a number and some operators(*,-,+,/). We would like to
>> represent and compute operators along operands during a number.
>> For example:
>>
>> N = 201
>> Operators: +,-,* and /
>>
>> Results should be represented as following down: (I represented just +
>> and - operators)
>> 2 + 0 + 1
>> 2 + 01 (wrong)
>> 20 + 1
>>
>> 2 + 0 - 1
>> 2 - 01 (wrong)
>> 20 - 1
>>
>> 2 - 0 + 1
>> 2 - 0 - 1
>>
>> We would not change the numbers and should insert operators between
>> operands and compute the possibility values. (For example 2 + 01 may not be
>> calculated)
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.