7 970
Subscribers
No data24 hours
No data7 days
No data30 days
Posts Archive
Flippity Flappity 1
ο Flag Question
Problem Description
Given an integer array X with size A. Initially, all the elements of this array are 0.
Given another integer array Y with the same size A, all the elements in it are
also 0.
You have to handle three types of operations/queries on the given arrays:
1 L R - Flip all the elements from 0 to 1 and 1 to 0 in the range L to R in the
array X.
2 P - For every element i β [1, A], Y[i] = Y[i] + X[i] * P
3 J - Find Y[J].
Given a 2D array B that represents the queries.
Query Type 1 - B[i][0] = 1, B[i][1] = L, B[i][2] = R.
Query Type 2 - B[i][0] = 2, B[i][1] = P, B[i][2] = 0.
Query Type 3 - B[i][0] = 3, B[i][1] = J, B[i][2] = 0.
Problem Constraints
1 <= A <= 10
1 <= L <= R <= A
1 <= J <= A
1 <= P <= 10
1 <= Number of Queries <= 5 * 10
Input Format
The first argument is a single integer A.
The second argument is a 2D integer array B.
Output Format
Return an integer array that represents the output of query type 3 in the input
order.
Example Input
def rev_sentence(sentence):
words = sentence.split(' ')
reverse_sentence = ' '.join(reversed(words))
return reverse_sentence
if name == "__main__":
input = 'metty to welcome'
print (rev_sentence(input))
anyone want geeks for geeks free course
course content is:
(i) Data Structure Algorithm
(ii) Aptitude and Reasoning
(iii) Operating System
mssg me
They are still waited us in queue.. while saying you are next in queue from 30 mins
Hi Sunil yadav Join Our Channel for daily Off-Campus Job Updates β€οΈ
ππ
@offcampusjobs_0
@offcampusjobs_0
