Invoiced Billing

CleverTap sends out invoices to all clients on the first day of each month, billed for the last month. For example, March’s invoice will be generated on the 1st of April. Some of the clients have their credits cards on file (billed automatically), and some choose to pay via cheques (posted to our office).

Our finance team needs to verify whether the cheque amount matches the due amount on the invoice generated or not.

Implement an efficient algorithm which is capable of handling 106 accounts. There will be no duplicate accounts.

Input Format:

    First argument of input contains a string array A denoting account names.
    Second argument of input contains a integer array B denoting due of corresponding account.
    Third argument of input contains a string array C denoting account names that pay by cheque.
    Fourth argument of input contains a integer array D denoting amount paid by cheque.

Output Format:

    return an integer denoting number of account that have not paid the exact invoice amount.

Constraints:

    1 <= M <= N <= 1000000
    1 <= |S| <= 10
    1 <= B[i] , D[i] <= 10000

For Example:

Input 1:
    A = ["Fabcars", "Fabtoys", "indianrail", "DMRC", "AbcPvtLtd"] B = [124, 45, 65, 40, 3000] C = ["AbcPvtLtd", "Fabtoys", "Fabcars"] D = [3000, 2000, 1000]
Output 1:
    2
Explanation:
    Fabcars and Fabtoys have a mismatch
Input 2:
    A = ["A", "B", "C", "D"] B = [1, 2, 3, 4] C = ["A", "B", "C", "D"] D = [1, 2, 3, 4]
Output 2:
    0
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Invoiced Billing on Interview Code Editor
Sign Up
to access hints and editorial solutions for Invoiced Billing

Discussion


Loading...
Click here to start solving coding interview questions