URL Hashing
INTERN
Implement an algorithm to hash a URL as described.
Suppose the given URL url of length n is to be hashed with a string hash_string of length m . Given an integer k , run the url through the following algorithm:
Given the string url , hash_string , and an integer k , find the hashed string.
Example 1 :
Input: url = "https://xyz.com", hashString = "pqrst", k =
4
Output: "psps"
Explanation:
Each hash value is divided by the len of hash_strong or 5 in this case. The
remainders oint to the characters in hash_string, and the answer is
"psps".
Get one-to-one training from Google Facebook engineers
Top-notch Professionals
Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.
Customized Private Class
Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.