Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Fiberlink (maas360) Interview Experience | Set 5 (Online Coding Question)

  • Difficulty Level : Hard
  • Last Updated : 27 Apr, 2016

Question:
Ticket Scalpers:
Given an array of tickets held by n scalpers.
The cost of a ticket at the scalper is equal to the number of tickets at a scalper at that particular moment. i.e if a 1st Scalper has 4 tickets at present then the cost of a ticket will be $4. After he sells that ticket he has 3 tickets, so the next ticket will cost $3 and so on.
If N number of tickets scalpers are seated outside a hockey stadium what is the maximum amount they can earn for the first ‘k’ tickets sold:

Input: Given n (Number of scalpers), given an array which has number of tickets held by each ticket scalper, the value of k.

Hey geek! It's time to become a success story instead of reading them. Check out our most renowned DSA Self Paced Course, now at a student-friendly price and become industry ready. And if you are looking for a more complete interview preparation resource, check out Complete Interview Preparation Course that will prepare you for the SDE role of your dreams!

Feeling prepared enough for your interview? Test your skills with our Test Series that will help you prepare for top companies like Amazon, Microsoft, TCS, Wipro, Google and many more!

Output: the max amount that can be earned by them by selling k tickets.



Eg:
Input:
2
2
5
4
Output: 14

Solution: 5+4+3+2 =14

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

My Personal Notes arrow_drop_up
Recommended Articles
Page :