Search This Blog
Here in this blog, one will get the latest technical news like - hiring challenges, coding competitions of different companies, opportunities for students, scholarships, and many more.
Featured
- Get link
- X
- Other Apps
Persistent Systems India Hiring Challenge - FY21 - Coding Challenge 2020
Persistent Systems India is hiring freshers(FY21) through their online challenges on the AMCAT platform. There are three stages in the first round. At the last stage, you will get two coding questions. I got the exam questions from my friend as he had his exam today. The objective and subjective questions were easy. Among two coding questions, one was easy and the other one was of moderate level.
I am sharing the easy one's question. You may or may not get the same question!!! So practice more.
N.B. For the coding round, you will get many options in languages including C, CPP, JAVA, Python, Pearl, etc.
Question - EASY level
An e-commerce company is planning to give a special discount on all its product to its customers for the Christmas holiday. The company possesses data on its stock of N product types. The data for each product type represents the count of customers who has ordered the given product. If the data K is positive then it shows that the product has been ordered by K customers and is in stock. If the data K is negative then it shows that it has been ordered by K customers but not in stock. The company will fulfill the order directly if the ordered product is in stock if it is not in stock, then the company will fulfill the order after they replenish the stock from the warehouse. They are planning to offer a discount amount A for each product. The discount value will be distributed to the customers who have purchased that selected product. The discount will be distributed only if the decided amount A can be divided by the number of orders for a particular product.
Write an algorithm for the sales team to find the number of products out of N for which the discount will be distributed.
Input Format
The first line of the input consists of two space-separated integers- numOfProducts and discountAmount, representing the number of different types of products(N) and the discount amount(A) that will be distributed among the customers.
The second line consists of N space-separated integers- order1, order2, ....,ordern representing the current status of the stock for the orders of the respective product types.
Output Format
Print an integer representing the number of products out of N for which the discount will be distributed.
Constraints
0 <= numOfProducts, discountAmount <= 10^5
-10^6 <= orderi <= 10^6
0 <= i <= numOfProducts
Example
Input
7 18
9 -13 8 -7 -8 18 10
Output
2
Explanation
The product for which the number of customers will collect the discount amount "3" are types 0 and 5, i.e. 9 and 18 respectively.
So, the output is 2.
You can write your query and solution approach in the comment section. For other test cases and solution comment below. We will send you the solution and it's FREE!!! And don't forget to subscribe to this blog to get the latest hiring news, coding news daily.
Thank you.
- Get link
- X
- Other Apps
Comments
Popular Posts
PERSISTENT SYSTEMS INDIA HIRING CHALLENGE - FY21 - CODING CHALLENGE 2021
- Get link
- X
- Other Apps
if the discount amount is 0 what will happen?
ReplyDeleteDiscount amount may or may not br 0. The only thing you need to consider is whether the discount is applicable or not.
DeleteI got different questions but thank you for sharing.
DeleteBro need the solution
DeleteIn which programming language you need the solution?
Deletein java
DeleteNeed solutions in c++
Deleteplease write us at reply.techdaily@gmail.com
DeleteI need the solution in c
Deleteplease write us at reply.techdaily@gmail.com
DeleteBro solution please
Deleteplease write us at reply.techdaily@gmail.com with your preferred programming language
DeleteI want code in c
DeleteSolution
ReplyDeleteCPP solution:
Delete// persistent solution
#include
#include
using namespace std;
int main()
{
long long int n, a, count = 0;
cin>>n>>a; // n: number of products a: discount
long long int products[n];
for(long long int i = 0; i < n; i++)
{
cin>>products[i]; // number of products of type i
if(products[i] > 0 && a % products[i] == 0)
count += 1; // count: counting the type of products on which discount is applicable
}
cout<<count<<endl;
return 0;
}
I need in python language
DeleteHello, Thank you for reaching to us. Please send us an email at the given mail id here so that we can send you the solution. Mail Id: reply.techdaily@gmail.com
DeleteI need the code please
DeleteIf you have any problem regarding the solution then feel free to reply here.
ReplyDeletenot working
DeleteIt is not working because header files are not there at the beginning. Otherwise the code is running properly.
DeleteI need solution in java
DeleteNeed code plzz
DeleteI need solution in c language
ReplyDeletePlease send that in my mail
DeletePlease write us at reply.techdaily@gmail.com
DeleteI want code in c
DeleteHello, Thank you for reaching to us. Please send us an email at the given mail id here so that we can send you the solution. Mail Id: reply.techdaily@gmail.com
ReplyDeleteOk
Deletemanduribharath99@gmail.com
DeleteSolution in java
ReplyDeleteHello, Thank you for reaching to us. Please send us an email at the given mail id here so that we can send you the solution. Mail Id: reply.techdaily@gmail.com
DeleteSolution in java
DeleteSolution in java
Deleteplease write us an email at reply.techdaily@gmail.com
DeleteI need java answer for this can you help me please.
DeleteI want solution at adinaikwadi8788@gmail.com
ReplyDeletePlease contact us at reply.techdaily@gmail.com to get the solution
DeleteIn need ans inc language asap
ReplyDeleteContact us at reply.techdaily@gmail.com
DeleteI need this answer very urgent. Plse write it to my mail kondurlikith@gmail.com
ReplyDeleteSolution for this question
ReplyDeleteSolutions plss
ReplyDeleteplease write us at reply.techdaily@gmail.com
DeleteI need solution
ReplyDeletePlease send solutions in c programming
ReplyDeleteSend solutions in python
ReplyDeletesolution in java
ReplyDeletewrite us at reply.techdaily@gmail.com
DeleteSend me the code in c language
ReplyDeleteSOLUTION IN PYTHON 3 PLEASE??
ReplyDeletewrite us at reply.techdaily@gmail.com
Deletesend solution to ayonroy7044@gmail.com
ReplyDeleteNeed solution in c
ReplyDeletewrite us at reply.techdaily@gmail.com
DeleteBro i need it in c
DeleteI need solution in python
ReplyDeletewrite us at reply.techdaily@gmail.com
DeleteSend the code in c to my mail aashishmeduri@gmail.com
ReplyDeletePlease write us at reply.techdaily@gmail.com
DeleteAns a n c
ReplyDeleteBroo i need help
ReplyDeleteCan u plz send this code in python to
tadekoru_sri@srmap.edu.in
Plz
Pls send the code in python for rsuprajar@gmail.com
DeleteWrite us at reply.techdaily@gmail.com
DeleteBro I need code very urgent please send me
ReplyDeleteNeed the solution in java
ReplyDeletePlease write us at reply.techdaily@gmail.com
DeleteCan you please send the solution in java on siyaverma0786@gmail.com
ReplyDeletePlease write us at reply.techdaily@gmail.com
DeleteI need code in c
ReplyDeletePlease write us at reply.techdaily@gmail.com
DeleteNeed immediately answer please
Deletewrite us at reply.techdaily@gmail.com
DeleteNeed solution in c++
ReplyDeleteSolution
ReplyDeleteWrite us at reply.techdaily@gmail.com
DeleteI want this question solution in php
ReplyDeletePlease share on 18793pooja@gmail.com
I need code in python
ReplyDeletePlease mail on alexsumit999@gmail.com