Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays and Queries #266

Open
5 tasks done
Rupa-Rd opened this issue Dec 16, 2023 · 2 comments
Open
5 tasks done

Arrays and Queries #266

Rupa-Rd opened this issue Dec 16, 2023 · 2 comments

Comments

@Rupa-Rd
Copy link

Rupa-Rd commented Dec 16, 2023

This issue is about [Algo/DS Name/Question Name](link to resource for the Algo/DS/Question)

  • I searched or browsed the repo’s other issues to ensure this is not a duplicate

  • Issue Title is in form [Algo/DS Name] in [Language] (ex:- BubbleSort in Java)

  • I will send my PR only after I'm assigned to this issue by any maintainer

  • Assign this issue to me (I want to work on this)

  • I ensure that I am not already assigned to 2 or more issues

Problem Statement

Given the array of length n denoting set of numbers and q denotes the number of queries
The queries of three types:

  1. l r : For each i with l <= i <= r a[i] = a[i]/d, where d is the smallest prime factor of a[i]
  2. l r : Print the sum of all a[i] with l <= i <= r
  3. i k : Set a[i] = k

Input Format:
-> The first line denotes n and q
-> The second line contains n number of integers
-> The third line contains q number of Queries in the above mentioned format

Output Format:
Print the values when the Query type 2 is called

Sample Test Case:
Input:
5 3
10 2 8 7 6
2 1 4
1 1 4
2 1 4
Output :
27
11

Explanation:
For Query [2 1 4] :
10 + 2 + 8 + 7 = 27
For Query [1 1 4] :
[5 1 4 1 6]
For Query [2 1 4] :
5 + 1 + 4 + 1 = 11

Source : This is a most recent question asked in BNY Mellon Challenge so I couldn't able to find any source for this question

@Rupa-Rd
Copy link
Author

Rupa-Rd commented Dec 16, 2023

Hi, @sobhanbera Could you assign this issue to me?

@Smritigit1202
Copy link

please assign the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants