Join Regular Classroom : Visit ClassroomTech

Nagarro Question Solved | Money Confusion | Codewindow.in

Hot Topics

Company Based – Codewindow

Interview Questions
1. TCS Technical Questions
2. CTS Technical Questions
3. Infosys Technical Questions
4. Capgemini Technical Questions
5. IBM Technical Questions
6. Wipro Technical Questions
7. Accenture Technical Questions
8. Deloitte Technical Questions
9. MindTree Technical Questions
10. NTT Data Technical Questions
11. Persistent Technical Questions
12. Hexaware Technical Questions
13. ZOHO Technical Questions
14. HCL Technical Questions
15. Genpact Technical Questions
16. udostres Technical Questions
17. samsung research Technical Questions
18. Media.net Technical Questions
19. Tejas Network Technical Questions
20. Kantar Technical Questions
21. Itron Technical Questions
22. Fractal Analyst Technical Questions
23. Lexmark International Technical Questions
24. Infeneon Technologies Technical Questions
25. Razorpay Technical Questions
26. payu Technical Questions
27. Navi Technical Questions
28. Tata Cliq Technical Questions
29. Grab Technical Questions
30. Schlumberger Technical Questions
31. Latenview Analytics Technical Questions
32. GreayB Technical Questions
33. Tally solution Technical Questions
34. Amagi Technical Questions
35. HFCL Technical Questions
36. Slice Technical Questions
37. Larsen & Turbo Technical Questions
38. Zenser Technical Questions
39. Siemens Technical Questions
40. Exon Movie Technical Questions
41. Gupshup Technical Questions
42. Smart cube Technical Questions
43. Celebal Tech Technical Questions
44. Teg Analytics Technical Questions
45. Commvault Systems Technical Questions
46. Incuture Technical Questions
47. Tiger Technical Questions
48. Bridgei2i Technical Questions
49. code nation Technical Questions
50. DE Show Technical Questions
51. Amazon Technical Questions
52. Flipkart Technical Questions
53. Morgan Stanly Technical Questions
54. duutsche bank Technical Questions
55. textas Technical Questions
56. pwc Technical Questions
57. salesforce Technical Questions
58. optum Technical Questions
59. Nvidia Technical Questions
60. Itc Infotech Technical Questions
61. linkedin Technical Questions
62. Adobe Technical Questions

Nagarro Question Solved | Money Confusion | Codewindow.in

In a laundry it happens often that people forget to take their money  out of their pockets and the money is washed with the clothes. the laundry man simply takes these wet notes out and put them sequentially under the sunlight to dry them. He does not mix them up. For example, if he gets 3 notes from one cloth, he places them sequentially and then places the notes received from other clothes and so on.

Shane forgot some money in his trousers and give his clothes to the laundry man, afterward, when he realized his mistake, He got back to the laundry and ask for his money. you have to tell the number of notes he forgot in his trousers if he knows the exact amount he forgot in his trouser.

 

Input Specification:

Input1: Total money Shane has. 

Input2: Total money the laundry man has.

Input3: An array of the order in which the notes are placed.

 

Output Specification:

Return the number of notes Shane has. Return 0 if his money is not there.

Example 1:

Input1: 15

Input2: 6

Input3: {1,4,20,3,10,5}

 

Output: 2

 

Explanation:

Note in the fifth position(10) and Note in the sixth position(5) add up to 15,which is the amount that Shane forgot.

 

Example 2:

Input1: 33

Input2: 6

Input3: {1,4,20,3,10,5}

 

Output: 3

 

Explanation:

Note in the third position(20), Note in the fourth position(3), and Note in the fifth position(10) add up to 33, which is the amount that Shane forgot.

Input:

15
4
{1,4,20,3,10,5}

Output:

2

Python

#https://codewindow.in
#join our telegram channel @codewindow

def moneyConfussion(input1, input2, input3):
    for i in range(len(input3)+1):
        for j in range(i+1,len(input3)+1):
            x=sum(input3[i:j])
            if x==input1:
                return len(input3[i:j])
        
    return 0

input1 = 33
input2 = 6
input3 = [1,4,20, 3,10, 5]
print(moneyConfussion(input1, input2, input3))

input1 = 15
input2 = 6
input3 = [1,4,20, 3,10, 5]
print(moneyConfussion(input1, input2, input3))

Nagarro Solved

Automata Fixing

      

Popular Category

Hot Topics

Company Based – Codewindow

Interview Questions
1. TCS Technical Questions
2. CTS Technical Questions
3. Infosys Technical Questions
4. Capgemini Technical Questions
5. IBM Technical Questions
6. Wipro Technical Questions
7. Accenture Technical Questions
8. Deloitte Technical Questions
9. MindTree Technical Questions
10. NTT Data Technical Questions
11. Persistent Technical Questions
12. Hexaware Technical Questions
13. ZOHO Technical Questions
14. HCL Technical Questions
15. Genpact Technical Questions
16. udostres Technical Questions
17. samsung research Technical Questions
18. Media.net Technical Questions
19. Tejas Network Technical Questions
20. Kantar Technical Questions
21. Itron Technical Questions
22. Fractal Analyst Technical Questions
23. Lexmark International Technical Questions
24. Infeneon Technologies Technical Questions
25. Razorpay Technical Questions
26. payu Technical Questions
27. Navi Technical Questions
28. Tata Cliq Technical Questions
29. Grab Technical Questions
30. Schlumberger Technical Questions
31. Latenview Analytics Technical Questions
32. GreayB Technical Questions
33. Tally solution Technical Questions
34. Amagi Technical Questions
35. HFCL Technical Questions
36. Slice Technical Questions
37. Larsen & Turbo Technical Questions
38. Zenser Technical Questions
39. Siemens Technical Questions
40. Exon Movie Technical Questions
41. Gupshup Technical Questions
42. Smart cube Technical Questions
43. Celebal Tech Technical Questions
44. Teg Analytics Technical Questions
45. Commvault Systems Technical Questions
46. Incuture Technical Questions
47. Tiger Technical Questions
48. Bridgei2i Technical Questions
49. code nation Technical Questions
50. DE Show Technical Questions
51. Amazon Technical Questions
52. Flipkart Technical Questions
53. Morgan Stanly Technical Questions
54. duutsche bank Technical Questions
55. textas Technical Questions
56. pwc Technical Questions
57. salesforce Technical Questions
58. optum Technical Questions
59. Nvidia Technical Questions
60. Itc Infotech Technical Questions
61. linkedin Technical Questions
62. Adobe Technical Questions

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories