Hi,

I am working on below challenge

http://codingbat.com/prob/p159339

I have not understood the description properly

please advise

I am working on below challenge

http://codingbat.com/prob/p159339

I have not understood the description properly

Array-3 > fix34

prev | next | chance

Return an array that contains exactly the same numbers as the given array, but rearranged so that every 3 is immediately followed by a 4. Do not move the 3's, but every other number may move. The array contains the same number of 3's and 4's, every 3 has a number after it that is not a 3 or 4, and a 3 appears in the array before any 4.

fix34([1, 3, 1, 4]) → [1, 3, 4, 1]

fix34([1, 3, 1, 4, 4, 3, 1]) → [1, 3, 4, 1, 1, 3, 4]

fix34([3, 2, 2, 4]) → [3, 4, 2, 2]

please advise

Do more with

EXPERT OFFICE^{®} is a registered trademark of EXPERTS EXCHANGE^{®}

In the given array, numbers 3 are not followed by a 4.

So:

1,3,5,4 will become 1,3,4,5

There will be a 3 before any 4 anyway..., Also for every three there will be a 4....

so it can be done in a single pass through the array.

so

```
fix34([1, 3, 1, 4, 4, 3, 1])
becomes [ 1, 3, 4, 1, 4, 3, 1]
-----
becomes [1, 3, 4, 1, 1, 3, 4] ?
-- --
```

## Premium Content

You need an Expert Office subscription to comment.Start Free Trial