# COVID-19 Minimum Risk Problem for delivery person

Author: Setter’s name
Editorialist: Editorialist’s name

SIMPLE-EASY

# PREREQUISITES:

Loops, Lists,Arrays,Conditional Statement

# PROBLEM:

You have to calculate the minimum risk for an employee of your courier service between different paths.

Suppose you own a delivery service and in this current covid-19 situation you have to measure the minimum risk of an employee who goes through many places. Which was Marked as 3 zones, RED, ORANGE, GREEN. Each place consists of points like the RED zone consists of 3 points, the ORANGE zone consists of 2 and the GREEN zone consists of 1 point. Each point is equivalent to the increasing amount of Risk.

Assume that you have two paths through the same area, (eg. RRGGO and OORRO) you have to calculate the minimum risk between these two paths for an employee. There can be 2 types of employees: One who has immunity and another without immunity.

One who has the immunity, will gain 1 point for going to the RED or ORANGE area, but 0 points for green as there is 0 risk associated.

But for the normal person the point system will be RED: 3, ORANGE: 2, GREEN: 1 as mentioned at the beginning of the question.

Your task is to find the path with minimum risk, and print the risk of that path.

EXAMPLE 1:
2
rrrgg
rrrgr
N
Output:
11

Example 2
3
ogrrr
rrrogr
gggooo
i
Output:
3

# QUICK EXPLANATION:

The problem can be solved using loop and Conditinal Check then simply print the minimum value.

# EXPLANATION:

You Required take number of paths then store it into list or array. Then you need to initialize a loop for total number of length for the current list. Then Check current employee status if he was immune person or normal person then again check the current path’s area or character then if its true then it will increment your risk counter variable’s risk. For Every Area There Will be different risk point . after completing the whole loop and incrementing for every condition you must store it into a list or array. Then if the number of test case is more then 1 then you need continue the same procedure and store it into a list or array after then you have to calculate the minimum value among the list Values. Then print it.

# SOLUTIONS:

Setter's Solution

num=int(input())
strLst=[]
for i in range(num):
strLst.append(input())
employee=(str(input()))

def simpleLoop(strLst,employee,new):
employee=employee.upper()
for i in strLst:
main(i,employee,new)
return min(new)

def main(area,employee,new):
counter=0
lst=list(area)

``````if( employee == "N" ):
for i in range(len(lst)):
simpleVal=(lst[i]).upper()
if(simpleVal  == "R" ):
counter+=3

elif(simpleVal == "O" ):
counter+=2

elif(simpleVal == "G" ):
counter+=1

elif(employee == "I" ):
for i in range(len(lst)):
simpleVal=(lst[i]).upper()
if(simpleVal == "R" or simpleVal== "O"  ):
counter+=1
elif(simpleVal== "G" ):
counter+=0
return new.append(counter)
``````

if name == “main”:
new=[]
print(simpleLoop(strLst,employee,new))

Editorialist's Solution

num=int(input())
strLst=[]
for i in range(num):
strLst.append(input())
employee=(str(input()))

def simpleLoop(strLst,employee,new):
employee=employee.upper()
for i in strLst:
main(i,employee,new)
return min(new)

def main(area,employee,new):
counter=0
lst=list(area)

``````if( employee == "N" ):
for i in range(len(lst)):
simpleVal=(lst[i]).upper()
if(simpleVal  == "R" ):
counter+=3

elif(simpleVal == "O" ):
counter+=2

elif(simpleVal == "G" ):
counter+=1

elif(employee == "I" ):
for i in range(len(lst)):
simpleVal=(lst[i]).upper()
if(simpleVal == "R" or simpleVal== "O"  ):
counter+=1
elif(simpleVal== "G" ):
counter+=0
return new.append(counter)
``````

if name == “main”:
new=[]
print(simpleLoop(strLst,employee,new))