You are trying to cross a river by jumping along stones. Every time you land on a stone, you hop forwards by the value of that stone. If you skip *over* a stone then its value doesn't affect you in any way. Eg:

```
 x--x-----x-->
[1][2][5][1]

```

Of course, crossing from the other side might give you a different answer:

```
 <--------x--x
   [1][2][5][1]

```

Given an array of positive integers, return the total number of steps it would take to go all the way across the river (and past the end of the array) and then all the way back. All arrays will contain at least one element, and may contain up to 100 elements. 

### Examples

```
  x--x-----x-->
 [1][2][1][2]
<----x-----x

therefore hop_across([1,2,1,2]) = 3 + 2 = 5

   x-----x--------x------>
  [2][2][3][1][1][2][1]
<--------x--x-----x--x

therefore hop_across([2,2,3,1,1,2,1]) = 3 + 4 = 7

```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def hop_across(lst):
	

Solutions:
def hop_across(lst):

	def one_side(lst):
		i = 0
		steps = 0
		while i < len(lst):
			i += lst[i]
			steps += 1
		return steps
	return one_side(lst) + one_side(lst[::-1])


def hop_across(lst):
	return dist(lst) + dist(lst[::-1])

def dist(lst):
	(s, i) = (0, 0)
	while i < len(lst):
		i += lst[i]
		s += 1
	return s


def hop_there(lst):
	pos = 0
	hops = 0
	while pos < len(lst):
		pos += lst[pos]
		hops += 1
	return hops

def hop_across(lst):
	return hop_there(lst) + hop_there(list(reversed(lst)))


def hop_across(lst, rev=True):
	(h, i) = (0, 0)
	while i < len(lst):
		i += lst[i]
		h += 1
	if rev:
		h += hop_across(lst[::-1], False)
	return h


def hop_across(lst):
	i = 0
	r = 0
	while i < len(lst):
		i += lst[i]
		r += 1
	i = len(lst) - 1
	while i >= 0:
		i -= lst[i]
		r += 1
	return r


def hop_across(lst):
	c = 0
	t = lst[:]
	while t:
		t = t[t[0]:]
		c += 1
	t = lst[::-1]
	while t:
		t = t[t[0]:]
		c += 1
	return c


def hop_across(lst):
	count = 0
	i = 0
	while i <= len(lst) - 1:
		i += lst[i]
		count += 1
	i = len(lst) - 1
	while i >= 0:
		i -= lst[i]
		count += 1
	return count


def hop_across(lst):

	def steps(l):
		(i, c) = (0, 0)
		while i < len(l):
			c += 1
			i += l[i]
		return c
	return steps(lst) + steps(lst[::-1])


def hop_across(lst):
	going = 0
	coming = 0
	output = 0
	while going < len(lst):
		output += 1
		going += lst[going]
	lst = lst[::-1]
	while coming < len(lst):
		output += 1
		coming += lst[coming]
	return output