All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : June 07, 2024
Last updated : July 01, 2024
Related Topics : Hash Table, String, Design, Hash Function
Acceptance Rate : 86.57 %
# Ain't no way this would work... right
# LMAO it did
class Codec:
def encode(self, longUrl: str) -> str:
"""Encodes a URL to a shortened URL.
"""
return longUrl
def decode(self, shortUrl: str) -> str:
"""Decodes a shortened URL to its original URL.
"""
return shortUrl
# Your Codec object will be instantiated and called as such:
# codec = Codec()
# codec.decode(codec.encode(url))
# Ain't no way this would work... right
# LMAO it did
class Codec:
def encode(self, longUrl: str) -> str:
"""Encodes a URL to a shortened URL.
"""
return longUrl
def decode(self, shortUrl: str) -> str:
"""Decodes a shortened URL to its original URL.
"""
return shortUrl
# Your Codec object will be instantiated and called as such:
# codec = Codec()
# codec.decode(codec.encode(url))