Skip to content

Commit 1568c36

Browse files
committed
Algorithms: Sorting Problems
1 parent 4cbf56b commit 1568c36

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Bubble Sort Problem
2+
#
3+
# A new deadly virus has infected large population of a planet. A brilliant scientist has discovered a new strain of
4+
# virus which can cure this disease. Vaccine produced from this virus has various strength depending on midichlorians
5+
# count. A person is cured only if midichlorians count in vaccine batch is more than midichlorians count of person. A
6+
# doctor receives a new set of report which contains midichlorians count of each infected patient, Practo stores all
7+
# vaccine doctor has and their midichlorians count. You need to determine if doctor can save all patients with the
8+
# vaccines he has. The number of vaccines and patients are equal.
9+
#
10+
# Input Format
11+
#
12+
# First line contains the number of vaccines - N. Second line contains N integers, which are strength of vaccines.
13+
# Third line contains N integers, which are midichlorians count of patients.
14+
#
15+
# Output Format
16+
#
17+
# Print a single line containing ′Yes′ or ′No′.
18+
#
19+
# Input Constraint
20+
# 1<N<10
21+
# Strength of vaccines and midichlorians count of patients fit in integer.
22+
#
23+
# SAMPLE INPUT
24+
# 5
25+
# 123 146 454 542 456
26+
# 100 328 248 689 200
27+
#
28+
# SAMPLE OUTPUT
29+
# No
30+
31+
n = int(input())
32+
vaccine = [int(i) for i in input().split()]
33+
patient = [int(i) for i in input().split()]
34+
count = 0
35+
for i in range(n):
36+
if vaccine[i] < patient[i]:
37+
count += 1
38+
39+
if count > 0:
40+
print('No')
41+
else:
42+
print('Yes')

0 commit comments

Comments
 (0)