
Asked in Wipro
Shopping Options Problem Statement
Given arrays representing the costs of pants, shirts, shoes, and skirts, and a budget amount 'X', determine the total number of valid combinations that can be purchased such that the total cost does not exceed 'X'. Each purchase must include exactly 1 item from each list.
Input:
The first line contains an integer ‘T’ denoting the number of test cases. Each test case consists of:
- Five integers ‘P’, ‘Q’, ‘R’, ‘S’, and ‘X’, representing the number of pants, shirts, shoes, skirts, and the budget amount, respectively.
- The second line contains ‘P’ integers, denoting the cost of each pant.
- The third line contains ‘Q’ integers, denoting the cost of each shirt.
- The fourth line contains ‘R’ integers, denoting the cost of each shoe.
- The fifth line contains ‘S’ integers, denoting the cost of each skirt.
Output:
For each test case, return an integer that represents the total number of valid combinations. Each result should be output on a new line.
Example:
Example input not provided in the original prompt.
Constraints:
1 <= T <= 100
1 <= P, Q, R, S <= 10
1 <= X <= 10^9
1 <= pants[i], shirts[i], shoes[i], skirts[i] <= 10^9
Note:
You do not need to print anything. Focus on implementing the required function to return the results.

AnswerBot
4mo
Determine total number of valid shopping combinations within budget
Iterate through all possible combinations of items from each array
Check if the total cost of the combination is within the budget
Retu...read more
Vaibhav Mali
2y
Algorithm:
Create an integer “answer” equal to 0.
First iterate over the list of pants, for each pant:
Then, iterate over the list of shirts, for each shirt:
Then, iterate over the list of shoes...read more
Help your peers!
Add answer anonymously...
Top Software Developer Interview Questions Asked at Wipro
Q. What is async and await?
Q. What is an operating system?
Q. What are the concepts of Object-Oriented Programming (OOP)?
Interview Questions Asked to Software Developer at Other Companies
Top Skill-Based Questions for Wipro Software Developer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

