🎁 Exclusive Offer! Join our
Telegram Channel
to get **special discounts** and updates! 🚀
Question 55 - 100% Working Solution | Buy Now
Description
6 Live
A service maintains a database with three string columns:
Column Name | Description
------------|------------
user_id | The user ID of the user who created the URL
short_url | The shortened URL
actual_url | The actual URL to redirect to
There are m users with ids from 0 to m - 1 and q requests for the short URLs. For each request i, report the actual URL and the number of requests processed for the user who created the short URL till the i-th request.
Given an array of n strings, database, where the i-th row is represented by the string database[i] in the format "<user_id> <short_url> <actual_url>", and q queries represented by the array of strings, queries, for each requested short URL, report an array of strings of length 2 with the actual URL and the number of times a request is made using a short URL created by a particular user.
Example
Suppose there are m = 3 users, database = ["0 sdsf www.google.com", "1 juytf www.google.com", "0 opoit www.kaggle.com"], and requests = ["juytf", "sdsf", "opoit"].
Short URL | Actual URL | Created By | Count for User
-----------|------------|------------|---------------
juytf | www.google.com | 1 | 1
sdsf | www.google.com | 0 | 1
opoit | www.kaggle.com | 0 | 2