# # Task:
  * #### Complete the pattern, using the special character ```■   □```
  * #### In this kata, we draw some histogram of the sound performance of ups and downs.

# # Rules:
  -  parameter ```waves```  The value of sound waves, an array of number, all number in array >=0.
  -  return a string, ```■``` represents the sound waves, and ```□``` represents the blank part, draw the histogram from bottom to top.

# # Example:

```
draw([1,2,3,4])

□□□■
□□■■
□■■■
■■■■

draw([1,2,3,3,2,1])

□□■■□□
□■■■■□
■■■■■■

draw([1,2,3,3,2,1,1,2,3,4,5,6,7])

□□□□□□□□□□□□■
□□□□□□□□□□□■■
□□□□□□□□□□■■■
□□□□□□□□□■■■■
□□■■□□□□■■■■■
□■■■■□□■■■■■■
■■■■■■■■■■■■■


draw([5,3,1,2,4,6,5,4,2,3,5,2,1])

□□□□□■□□□□□□□
■□□□□■■□□□■□□
■□□□■■■■□□■□□
■■□□■■■■□■■□□
■■□■■■■■■■■■□
■■■■■■■■■■■■■

draw([1,0,1,0,1,0,1,0])

■□■□■□■□
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Ad-hoc

Starter code: def draw(waves):
	

Solutions:
def draw(waves):
	m = max(waves)
	rotHist = [('■' * v).rjust(m, '□') for v in waves]
	return '\n'.join(map(''.join, zip(*rotHist)))


def draw(waves):
	m = max(waves)
	return '\n'.join((''.join(('□■'[x > i] for x in waves)) for i in reversed(range(m))))


ON = '■'
OFF = '□'

def draw(waves):
	result = ''
	height = max(waves)
	for line in range(height, 0, -1):
		for wave in waves:
			if wave >= line:
				result += ON
			else:
				result += OFF
		result += '\n'
	return result.strip()


def draw(waves):
	mx = max(waves)
	return '\n'.join([''.join(e) for e in zip(*[('■' * e).ljust(mx, '□') for e in waves])][::-1])


def draw(waves):
	wave = []
	while sum(waves) != 0:
		black = max(waves)
		cur = ''
		for i in range(len(waves)):
			if waves[i] < black:
				cur += '□'
			else:
				cur += '■'
				waves[i] -= 1
		wave.append(cur)
	return '\n'.join(wave)


def draw(waves):
	m = max(waves)
	return '\n'.join((''.join(('□' if n < m - row else '■' for n in waves)) for row in range(m)))


def draw(waves):
	result = ''
	height = max(waves)
	weight = len(waves)
	for i in range(height):
		for j in range(weight):
			if waves[j] >= height - i:
				result += '■'
			else:
				result += '□'
		if i != height - 1:
			result += '\n'
	return result


def draw(waves):
	mx = max(waves)
	return '\n'.join((''.join(c) for c in zip(*[(mx - w) * '□' + w * '■' for w in waves])))


def draw(a):
	n = iter(a)
	li = [('■' * next(n)).ljust(max(a), '□') for i in range(len(a))]
	return '\n'.join([''.join(i) for i in list(zip(*li))[::-1]])


FILLED = '■'
EMPTY = '□'

def draw(waves):
	result = ''
	height = max(waves)
	width = len(waves)
	matrix = [[EMPTY for x in range(width)] for y in range(height)]
	for (y, value) in enumerate(waves):
		for x in range(value):
			matrix[x][y] = FILLED
	for row in range(height - 1, -1, -1):
		result = result + ''.join(matrix[row]) + '\n'
	return result.strip()