Question: Consider a JSON string that looks like this: [ Swiggy , 1 2 3 ] , [ Swiggy , 2 2

Consider a JSON string that looks like this:
["Swiggy",123],
["Swiggy",227],
['"Zomato",103],
["Zomato",171],
["Dunzo",131],
['"Zomato",122],
["Swiggy",181] This string encodes a list of payments made by a person for various delivery services. Each element of the list is a itself a list of two elements the first is the name of the service, and the second is the amount.
Write a function/method in JavaScript to take such a string and return the number of services for which this person has never paid an amount of 200 or more.
For example, if the above string is passed to your code, it should return 2(since this person has never paid 200 or more for Zomato and Dunzo.) Remember, the input will be passed to you as a string.
In the comments in your code, indicate what is the running time of your program e.g. O(n ^2) or O (n log(n)). You get bonus points if your program has a average running time of 0(n * log(n)) or O(n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!