# Description
You are required to implement a function `find_nth_occurrence` that returns the index of the nth occurrence of a substring within a string (considering that those substring could overlap each others). If there are less than n occurrences of the substring, return -1.

# Example
```python
string = "This is an example. Return the nth occurrence of example in this example string."
find_nth_occurrence("example", string, 1) == 11
find_nth_occurrence("example", string, 2) == 49
find_nth_occurrence("example", string, 3) == 65
find_nth_occurrence("example", string, 4) == -1
```

Multiple occurrences of a substring are allowed to overlap, e.g.
```python
find_nth_occurrence("TestTest", "TestTestTestTest", 1) == 0
find_nth_occurrence("TestTest", "TestTestTestTest", 2) == 4
find_nth_occurrence("TestTest", "TestTestTestTest", 3) == 8
find_nth_occurrence("TestTest", "TestTestTestTest", 4) == -1
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def find_nth_occurrence(substring, string, occurrence=1):
	

Solutions:
def find_nth_occurrence(substring, string, occurrence=1):
	idx = -1
	for i in range(occurrence):
		idx = string.find(substring, idx + 1)
		if idx == -1:
			return -1
	return idx


import re

def find_nth_occurrence(sb, s, n=1):
	r = list(re.finditer('(?=' + sb + ')', s))
	return r[n - 1].span()[0] if n <= len(r) else -1


import re

def find_nth_occurrence(substring, string, occurrence):
	try:
		return [s.start() for s in re.finditer('(?=' + substring + ')', string)][occurrence - 1]
	except:
		return -1


def find_nth_occurrence(substring, string, occurrence=1):
	i = -1
	for _ in range(occurrence):
		i = string.find(substring, i + 1)
		if i == -1:
			break
	return i


def find_nth_occurrence(substring, string, occurrence=1):
	index = -1
	for occ in range(0, occurrence):
		index = string.find(substring, index + 1)
	return index


def find_nth_occurrence(w, s, n=1, k=0):
	for i in range(len(s)):
		if s[i:i + len(w)] == w:
			k += 1
			if k == n:
				return i
	else:
		return -1


def find_nth_occurrence(substring, string, occurrence=1):
	indicies = [i for i in range(len(string)) if string.startswith(substring, i)]
	if occurrence > len(indicies):
		return -1
	else:
		return indicies[occurrence - 1]


import re

def find_nth_occurrence(substring, string, occurrence=1):
	try:
		return [m.start() for m in re.finditer(f'(?={substring})', string)][occurrence - 1]
	except:
		return -1


def find_nth_occurrence(substring, string, occurrence=1):
	(c, i) = (1, string.find(substring))
	while c < occurrence and i > -1:
		(c, i) = (c + 1, string.find(substring, i + 1))
	return i


def find_nth_occurrence(substring, string, occurrence):
	a = string.find(substring)
	while a >= 0 and occurrence > 1:
		a = string.find(substring, a + 1)
		occurrence -= 1
	return a