in reply to Simple Logic Problem with Perl
If the index difference of two consecutive sample is 1 take the first colum of the first string PLUS the 2nd column -last one- of the last string.
In your first sample, the index of the first item is 1 and the index of the second item is 2, so the difference is 1 and this rule applies.
We then take the first colum of the first string, which is str1, PLUS the 2nd column -last one- of the last string. Here I'm already stuck: there are three columns, so the second one cannot be the last one. We will assume you mean col2, so the second item in your output should be str4. But in your result it shows str3. Assuming that your results are correct your description of the algorithm must be wrong or I have misunderstood it.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simple Logic Problem with Perl
by Anonymous Monk on Oct 19, 2005 at 12:14 UTC |