Description

Lets imagine a yoga classroom as a Square 2D Array of Integers ```classroom```, with each integer representing a person, and the value representing their skill level.

```
classroom = [
            [3,2,1,3],
            [1,3,2,1],
            [1,1,1,2],
            ]
            
poses = [1,7,5,9,10,21,4,3]
```

During a yoga class the instructor gives a list of integers ```poses``` representing a yoga pose that each person in the class will attempt to complete.

A person can complete a yoga pose if the sum of their row and their skill level is greater than or equal to the value of the pose.

 Task

Your task is to return the total amount poses completed for the entire ```classroom```.

Example

```
classroom = [
            [1,1,0,1], #sum = 3
            [2,0,6,0], #sum = 8
            [0,2,2,0], #sum = 4
            ]
                    
poses = [4, 0, 20, 10]

3 people in row 1 can complete the first pose
Everybody in row 1 can complete the second pose
Nobody in row 1 can complete the third pose
Nobody in row 1 can complete the fourth pose

The total poses completed for row 1 is 7

You'll need to return the total for all rows and all poses.
```

Translations are welcomed!

Difficulty: introductory

Starter code:

def yoga(classroom, poses):
	

Solutions:
def yoga(classroom, poses):
    total_poses = 0
    for pose in poses:
        for row in classroom:
            for person in row:
                if person + sum(row) >= pose:
                    total_poses += 1
    return total_poses

def yoga(classroom, poses):
    return sum(1 for r in classroom for v in r for p in poses if p<=v+sum(r))

def yoga(room, poses):
    return sum(sum(v<=p+s for v in poses for p in r) for r,s in ((r,sum(r)) for r in room) )

def yoga(classroom, poses):
    result = 0
    for row in classroom:
        s = sum(row)
        result += sum(s+x >= p for x in row for p in poses)
    return result

from bisect import bisect_left

def yoga(a, b):
    c = []
    for x in a:
        y = sum(x)
        c.append([z + y for z in sorted(x)])
    return sum(sum(len(x) - bisect_left(x, y) for y in b) for x in c)

def yoga(classroom, poses):
    return sum(1 for row in classroom for o in row for p in poses if o + sum(row) >= p)


yoga = lambda classroom, poses: sum(sum(len([1 for p in poses if p<=c+sum(r)]) for c in r) for r in classroom)


def yoga(classroom, poses):
    if not classroom or not poses:
        return 0
    res = 0
    for row in classroom:
        row_sum = sum(row)
        for pose in poses:
            for person in row:
                if person + row_sum >= pose:
                    res += 1
    return res

def yoga(classroom, poses):
    return len([z for i in poses for k in classroom for z in k if sum(k) + z >= i])


def yoga(classroom, poses):
    new_classroom = []
    for row in classroom:
        row_sum = sum(row)
        new_row = []
        for person in row:
            new_row.append(person + row_sum)
        new_classroom.append(new_row)
    people = [person for row in new_classroom for person in row]

    result = 0
    for pose in poses:
        for person in people:
            if person >= pose:
                result += 1
    return result