Design a URL shortening system where you can encode a long URL into a shortened URL and decode it back to the original URL. The system should guarantee that the original URL can always be retrieved using the shortened version.
Given the roots of two binary trees, root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise. A subtree of a binary tree consists of a node in the tree and all of this node’s descendants.
Design a custom HashSet without using any built-in hash table libraries. Implement the MyHashSet class with methods to add, remove, and check the existence of a value.
You are given a binary string s and an integer k. Your task is to determine if every possible binary code of length k appears as a substring within s. Return true if all such binary codes are present, otherwise return false.
You are given an integer array nums and two integers k and p. Your task is to count the number of distinct subarrays where there are at most k elements divisible by p. A subarray is defined as a contiguous part of the array, and two subarrays are considered distinct if they differ in either length or at least one element.