Skip to main content

Join the Tech Community

daily-leetcoding-challenge
daily-leetcoding-challenge

Best Time to Buy and Sell Stock with Transaction Fee

Encode and Decode TinyURL

class Solution { unordered_map<size_t, string> lookup; public: // Encodes a URL to a shortened URL. string encode(string longUrl) { size_t shortUrl = hash<string> {} (longUrl); lookup[shortUrl] = longUrl; return to_string(shortUrl); } // Decodes a shortened URL to its original URL.... (More)