Wrong Judegment | Encode and Decode TinyURL
110
Mar 19, 2021

Ques. Encode and Decode TinyURL

Hey Guys , In the above question we have to encode the url so that it appears smaller, and then decode it again to get the original URL back , but passing the URL as it is still gives you the right answer , I guess there must be a URL length comparision check as well !!!!

public class Codec {

// Encodes a URL to a shortened URL.

public String encode(String longUrl) {       
    return longUrl;
}

// Decodes a shortened URL to its original URL.
public String decode(String shortUrl) {    
    return shortUrl;
}

}
image

Comments (1)