FastPrepCount Sales Rung Up at the Wrong Price
Problems/Count Sales Rung Up at the Wrong Price

Count Sales Rung Up at the Wrong Price

DocuSign logoDocuSign● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two reports from February 2021 describe this as the first of two online assessment questions. A store has a price list and a list of sales, and you count the sales that charged the wrong amount. One report adds that a lookup by name is all it takes.

The reports give no limits and no examples. They also do not say how prices are written, or what to do with unknown or repeated product names. Here prices are whole numbers of cents. Every sold product is on the price list. List names are all different. Each sale counts on its own. We wrote the examples.

Our version is about 90% the same as the reported questions.

A store keeps a price list: products[i] is a product name and prices[i] is its correct price in cents.

It also has a record of its sales: sale j sold the product soldProducts[j] and charged soldPrices[j] cents.

A sale is an error when the amount charged is not the correct price of the product that was sold. Each sale is checked on its own, so a product that was sold wrong three times gives three errors.

Return the number of errors.

Function

countPriceErrors(products: String[], prices: int[], soldProducts: String[], soldPrices: int[]) → int

Examples

Example 1

products = ["pen","ink","pad"]prices = [150,899,425]soldProducts = ["ink","pen","ink","pad","pen"]soldPrices = [899,125,989,425,150]return = 2

The correct prices are pen 150, ink 899 and pad 425 cents.

  • Sale 0: ink at 899. Correct.
  • Sale 1: pen at 125, but it should be 150. Error.
  • Sale 2: ink at 989, but it should be 899. Error.
  • Sale 3: pad at 425. Correct.
  • Sale 4: pen at 150. Correct.

There are 2 errors.

Example 2

products = ["tea","mug"]prices = [300,1200]soldProducts = ["mug","tea"]soldPrices = [1200,300]return = 0

Both sales use the correct price, so there are 0 errors.

Example 3

products = ["lamp","bulb"]prices = [4999,250]soldProducts = ["bulb","bulb","bulb"]soldPrices = [205,250,520]return = 2

Each sale is checked on its own. bulb should cost 250. The sales at 205 and 520 are wrong and the one at 250 is right, so the answer is 2. lamp is never sold, which is fine.

Constraints

  • 1 <= products.length <= 1000
  • prices.length == products.length
  • 1 <= soldProducts.length <= 5000
  • soldPrices.length == soldProducts.length
  • Every name has 1 to 10 characters, all lowercase English letters.
  • The names in products are all different.
  • Every name in soldProducts appears in products.
  • 1 <= prices[i], soldPrices[j] <= 10^7

More DocuSign Online Assessment questions

  • Max Sum With No Two Adjacent PicksOA · Seen Apr 2026
  • Max Sum With No Two Adjacent Picks on a CircleOA · Seen Apr 2026
  • Beautiful Number OrderingsOA · Seen Feb 2026
  • Grid Path With the Most ClearanceOA · Seen May 2025
  • Vehicle Mixes for a Wheel TotalOA · Seen May 2025
  • Most Disjoint Intervals From Starts and DurationsOA · Seen Feb 2021
  • Fewest Fountains to Water the GardenOA · Seen Feb 2021
  • Lowest Start That Keeps Running Totals PositiveOA · Seen Feb 2021
  • Fewest Student Groups Within a Level GapOA · Seen Nov 2020
  • Alphabetize a Word ListOA · Seen May 2020

Similar questions at other companies

  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
  • Customer Signer ScreeningState Farm · OA
  • String-Pair Frequency SimilarityIBM · OAIBM interview questions
  • Number-Character Bijective MappingAdobe · OAAdobe interview questions
  • Unique Difference PatternMicrosoft · OAMicrosoft interview questions
  • Filter Transaction Logs and Calculate Reliability MetricsStripe · OAStripe interview questions
  • Nonzero Totals by NameEPAM · OAEPAM interview questions
  • Palindrome-Rearrangeable PairsExpedia · OAExpedia interview questions

Interview reports that mention this question

  • DocuSign SWE Intern OA Questions: 53 Experiences (Part 1 of 2)

DocuSign interview experiences

  • DocuSign SWE Intern Interviews: 27 Experiences (Part 2 of 2)
All DocuSign interview questionsSee DocuSign hiring insights
Saved
class Solution {
    public int countPriceErrors(String[] products, int[] prices, String[] soldProducts, int[] soldPrices) {
        // Write your code here.
    }
}
Checking account…