Design Authentication Manager
<p>There is an authentication system that works with authentication tokens. For each session, the user will receive a new authentication token that will expire <code>timeToLive</code> seconds after the <code>currentTime</code>. If the token is renewed, the expiry time will be <b>extended</b> to expire <code>timeToLive</code> seconds after the (potentially different) <code>currentTime</code>.</p>

<p>Implement the <code>AuthenticationManager</code> class:</p>

<ul>
	<li><code>AuthenticationManager(int timeToLive)</code> constructs the <code>AuthenticationManager</code> and sets the <code>timeToLive</code>.</li>
	<li><code>generate(string tokenId, int currentTime)</code> generates a new token with the given <code>tokenId</code> at the given <code>currentTime</code> in seconds.</li>
	<li><code>renew(string tokenId, int currentTime)</code> renews the <strong>unexpired</strong> token with the given <code>tokenId</code> at the given <code>currentTime</code> in seconds. If there are no unexpired tokens with the given <code>tokenId</code>, the request is ignored, and nothing happens.</li>
	<li><code>countUnexpiredTokens(int currentTime)</code> returns the number of <strong>unexpired</strong> tokens at the given currentTime.</li>
</ul>

<p>Note that if a token expires at time <code>t</code>, and another action happens on time <code>t</code> (<code>renew</code> or <code>countUnexpiredTokens</code>), the expiration takes place <strong>before</strong> the other actions.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2021/02/25/copy-of-pc68_q2.png" style="width: 500px; height: 287px;" />
<pre>
<strong>Input</strong>
[&quot;AuthenticationManager&quot;, &quot;<code>renew</code>&quot;, &quot;generate&quot;, &quot;<code>countUnexpiredTokens</code>&quot;, &quot;generate&quot;, &quot;<code>renew</code>&quot;, &quot;<code>renew</code>&quot;, &quot;<code>countUnexpiredTokens</code>&quot;]
[[5], [&quot;aaa&quot;, 1], [&quot;aaa&quot;, 2], [6], [&quot;bbb&quot;, 7], [&quot;aaa&quot;, 8], [&quot;bbb&quot;, 10], [15]]
<strong>Output</strong>
[null, null, null, 1, null, null, null, 0]

<strong>Explanation</strong>
AuthenticationManager authenticationManager = new AuthenticationManager(5); // Constructs the AuthenticationManager with <code>timeToLive</code> = 5 seconds.
authenticationManager.<code>renew</code>(&quot;aaa&quot;, 1); // No token exists with tokenId &quot;aaa&quot; at time 1, so nothing happens.
authenticationManager.generate(&quot;aaa&quot;, 2); // Generates a new token with tokenId &quot;aaa&quot; at time 2.
authenticationManager.<code>countUnexpiredTokens</code>(6); // The token with tokenId &quot;aaa&quot; is the only unexpired one at time 6, so return 1.
authenticationManager.generate(&quot;bbb&quot;, 7); // Generates a new token with tokenId &quot;bbb&quot; at time 7.
authenticationManager.<code>renew</code>(&quot;aaa&quot;, 8); // The token with tokenId &quot;aaa&quot; expired at time 7, and 8 &gt;= 7, so at time 8 the <code>renew</code> request is ignored, and nothing happens.
authenticationManager.<code>renew</code>(&quot;bbb&quot;, 10); // The token with tokenId &quot;bbb&quot; is unexpired at time 10, so the <code>renew</code> request is fulfilled and now the token will expire at time 15.
authenticationManager.<code>countUnexpiredTokens</code>(15); // The token with tokenId &quot;bbb&quot; expires at time 15, and the token with tokenId &quot;aaa&quot; expired at time 7, so currently no token is unexpired, so return 0.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= timeToLive &lt;= 10<sup>8</sup></code></li>
	<li><code>1 &lt;= currentTime &lt;= 10<sup>8</sup></code></li>
	<li><code>1 &lt;= tokenId.length &lt;= 5</code></li>
	<li><code>tokenId</code> consists only of lowercase letters.</li>
	<li>All calls to <code>generate</code> will contain unique values of <code>tokenId</code>.</li>
	<li>The values of <code>currentTime</code> across all the function calls will be <strong>strictly increasing</strong>.</li>
	<li>At most <code>2000</code> calls will be made to all functions combined.</li>
</ul>

[]
[]
[{"value": "cpp", "text": "C++", "defaultCode": "class AuthenticationManager {\npublic:\n    AuthenticationManager(int timeToLive) {\n        \n    }\n    \n    void generate(string tokenId, int currentTime) {\n        \n    }\n    \n    void renew(string tokenId, int currentTime) {\n        \n    }\n    \n    int countUnexpiredTokens(int currentTime) {\n        \n    }\n};\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * AuthenticationManager* obj = new AuthenticationManager(timeToLive);\n * obj->generate(tokenId,currentTime);\n * obj->renew(tokenId,currentTime);\n * int param_3 = obj->countUnexpiredTokens(currentTime);\n */"}, {"value": "java", "text": "Java", "defaultCode": "class AuthenticationManager {\n\n    public AuthenticationManager(int timeToLive) {\n        \n    }\n    \n    public void generate(String tokenId, int currentTime) {\n        \n    }\n    \n    public void renew(String tokenId, int currentTime) {\n        \n    }\n    \n    public int countUnexpiredTokens(int currentTime) {\n        \n    }\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * AuthenticationManager obj = new AuthenticationManager(timeToLive);\n * obj.generate(tokenId,currentTime);\n * obj.renew(tokenId,currentTime);\n * int param_3 = obj.countUnexpiredTokens(currentTime);\n */"}, {"value": "python", "text": "Python", "defaultCode": "class AuthenticationManager(object):\n\n    def __init__(self, timeToLive):\n        \"\"\"\n        :type timeToLive: int\n        \"\"\"\n        \n\n    def generate(self, tokenId, currentTime):\n        \"\"\"\n        :type tokenId: str\n        :type currentTime: int\n        :rtype: None\n        \"\"\"\n        \n\n    def renew(self, tokenId, currentTime):\n        \"\"\"\n        :type tokenId: str\n        :type currentTime: int\n        :rtype: None\n        \"\"\"\n        \n\n    def countUnexpiredTokens(self, currentTime):\n        \"\"\"\n        :type currentTime: int\n        :rtype: int\n        \"\"\"\n        \n\n\n# Your AuthenticationManager object will be instantiated and called as such:\n# obj = AuthenticationManager(timeToLive)\n# obj.generate(tokenId,currentTime)\n# obj.renew(tokenId,currentTime)\n# param_3 = obj.countUnexpiredTokens(currentTime)"}, {"value": "python3", "text": "Python3", "defaultCode": "class AuthenticationManager:\n\n    def __init__(self, timeToLive: int):\n        \n\n    def generate(self, tokenId: str, currentTime: int) -> None:\n        \n\n    def renew(self, tokenId: str, currentTime: int) -> None:\n        \n\n    def countUnexpiredTokens(self, currentTime: int) -> int:\n        \n\n\n# Your AuthenticationManager object will be instantiated and called as such:\n# obj = AuthenticationManager(timeToLive)\n# obj.generate(tokenId,currentTime)\n# obj.renew(tokenId,currentTime)\n# param_3 = obj.countUnexpiredTokens(currentTime)"}, {"value": "c", "text": "C", "defaultCode": "\n\n\ntypedef struct {\n    \n} AuthenticationManager;\n\n\nAuthenticationManager* authenticationManagerCreate(int timeToLive) {\n    \n}\n\nvoid authenticationManagerGenerate(AuthenticationManager* obj, char* tokenId, int currentTime) {\n    \n}\n\nvoid authenticationManagerRenew(AuthenticationManager* obj, char* tokenId, int currentTime) {\n    \n}\n\nint authenticationManagerCountUnexpiredTokens(AuthenticationManager* obj, int currentTime) {\n    \n}\n\nvoid authenticationManagerFree(AuthenticationManager* obj) {\n    \n}\n\n/**\n * Your AuthenticationManager struct will be instantiated and called as such:\n * AuthenticationManager* obj = authenticationManagerCreate(timeToLive);\n * authenticationManagerGenerate(obj, tokenId, currentTime);\n \n * authenticationManagerRenew(obj, tokenId, currentTime);\n \n * int param_3 = authenticationManagerCountUnexpiredTokens(obj, currentTime);\n \n * authenticationManagerFree(obj);\n*/"}, {"value": "csharp", "text": "C#", "defaultCode": "public class AuthenticationManager {\n\n    public AuthenticationManager(int timeToLive) {\n        \n    }\n    \n    public void Generate(string tokenId, int currentTime) {\n        \n    }\n    \n    public void Renew(string tokenId, int currentTime) {\n        \n    }\n    \n    public int CountUnexpiredTokens(int currentTime) {\n        \n    }\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * AuthenticationManager obj = new AuthenticationManager(timeToLive);\n * obj.Generate(tokenId,currentTime);\n * obj.Renew(tokenId,currentTime);\n * int param_3 = obj.CountUnexpiredTokens(currentTime);\n */"}, {"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number} timeToLive\n */\nvar AuthenticationManager = function(timeToLive) {\n    \n};\n\n/** \n * @param {string} tokenId \n * @param {number} currentTime\n * @return {void}\n */\nAuthenticationManager.prototype.generate = function(tokenId, currentTime) {\n    \n};\n\n/** \n * @param {string} tokenId \n * @param {number} currentTime\n * @return {void}\n */\nAuthenticationManager.prototype.renew = function(tokenId, currentTime) {\n    \n};\n\n/** \n * @param {number} currentTime\n * @return {number}\n */\nAuthenticationManager.prototype.countUnexpiredTokens = function(currentTime) {\n    \n};\n\n/** \n * Your AuthenticationManager object will be instantiated and called as such:\n * var obj = new AuthenticationManager(timeToLive)\n * obj.generate(tokenId,currentTime)\n * obj.renew(tokenId,currentTime)\n * var param_3 = obj.countUnexpiredTokens(currentTime)\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "class AuthenticationManager {\n    constructor(timeToLive: number) {\n        \n    }\n\n    generate(tokenId: string, currentTime: number): void {\n        \n    }\n\n    renew(tokenId: string, currentTime: number): void {\n        \n    }\n\n    countUnexpiredTokens(currentTime: number): number {\n        \n    }\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * var obj = new AuthenticationManager(timeToLive)\n * obj.generate(tokenId,currentTime)\n * obj.renew(tokenId,currentTime)\n * var param_3 = obj.countUnexpiredTokens(currentTime)\n */"}, {"value": "php", "text": "PHP", "defaultCode": "class AuthenticationManager {\n    /**\n     * @param Integer $timeToLive\n     */\n    function __construct($timeToLive) {\n        \n    }\n  \n    /**\n     * @param String $tokenId\n     * @param Integer $currentTime\n     * @return NULL\n     */\n    function generate($tokenId, $currentTime) {\n        \n    }\n  \n    /**\n     * @param String $tokenId\n     * @param Integer $currentTime\n     * @return NULL\n     */\n    function renew($tokenId, $currentTime) {\n        \n    }\n  \n    /**\n     * @param Integer $currentTime\n     * @return Integer\n     */\n    function countUnexpiredTokens($currentTime) {\n        \n    }\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * $obj = AuthenticationManager($timeToLive);\n * $obj->generate($tokenId, $currentTime);\n * $obj->renew($tokenId, $currentTime);\n * $ret_3 = $obj->countUnexpiredTokens($currentTime);\n */"}, {"value": "swift", "text": "Swift", "defaultCode": "\nclass AuthenticationManager {\n\n    init(_ timeToLive: Int) {\n        \n    }\n    \n    func generate(_ tokenId: String, _ currentTime: Int) {\n        \n    }\n    \n    func renew(_ tokenId: String, _ currentTime: Int) {\n        \n    }\n    \n    func countUnexpiredTokens(_ currentTime: Int) -> Int {\n        \n    }\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * let obj = AuthenticationManager(timeToLive)\n * obj.generate(tokenId, currentTime)\n * obj.renew(tokenId, currentTime)\n * let ret_3: Int = obj.countUnexpiredTokens(currentTime)\n */"}, {"value": "kotlin", "text": "Kotlin", "defaultCode": "class AuthenticationManager(timeToLive: Int) {\n\n    fun generate(tokenId: String, currentTime: Int) {\n        \n    }\n\n    fun renew(tokenId: String, currentTime: Int) {\n        \n    }\n\n    fun countUnexpiredTokens(currentTime: Int): Int {\n        \n    }\n\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * var obj = AuthenticationManager(timeToLive)\n * obj.generate(tokenId,currentTime)\n * obj.renew(tokenId,currentTime)\n * var param_3 = obj.countUnexpiredTokens(currentTime)\n */"}, {"value": "dart", "text": "Dart", "defaultCode": "class AuthenticationManager {\n\n  AuthenticationManager(int timeToLive) {\n    \n  }\n  \n  void generate(String tokenId, int currentTime) {\n    \n  }\n  \n  void renew(String tokenId, int currentTime) {\n    \n  }\n  \n  int countUnexpiredTokens(int currentTime) {\n    \n  }\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * AuthenticationManager obj = AuthenticationManager(timeToLive);\n * obj.generate(tokenId,currentTime);\n * obj.renew(tokenId,currentTime);\n * int param3 = obj.countUnexpiredTokens(currentTime);\n */"}, {"value": "golang", "text": "Go", "defaultCode": "type AuthenticationManager struct {\n    \n}\n\n\nfunc Constructor(timeToLive int) AuthenticationManager {\n    \n}\n\n\nfunc (this *AuthenticationManager) Generate(tokenId string, currentTime int)  {\n    \n}\n\n\nfunc (this *AuthenticationManager) Renew(tokenId string, currentTime int)  {\n    \n}\n\n\nfunc (this *AuthenticationManager) CountUnexpiredTokens(currentTime int) int {\n    \n}\n\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * obj := Constructor(timeToLive);\n * obj.Generate(tokenId,currentTime);\n * obj.Renew(tokenId,currentTime);\n * param_3 := obj.CountUnexpiredTokens(currentTime);\n */"}, {"value": "ruby", "text": "Ruby", "defaultCode": "class AuthenticationManager\n\n=begin\n    :type time_to_live: Integer\n=end\n    def initialize(time_to_live)\n        \n    end\n\n\n=begin\n    :type token_id: String\n    :type current_time: Integer\n    :rtype: Void\n=end\n    def generate(token_id, current_time)\n        \n    end\n\n\n=begin\n    :type token_id: String\n    :type current_time: Integer\n    :rtype: Void\n=end\n    def renew(token_id, current_time)\n        \n    end\n\n\n=begin\n    :type current_time: Integer\n    :rtype: Integer\n=end\n    def count_unexpired_tokens(current_time)\n        \n    end\n\n\nend\n\n# Your AuthenticationManager object will be instantiated and called as such:\n# obj = AuthenticationManager.new(time_to_live)\n# obj.generate(token_id, current_time)\n# obj.renew(token_id, current_time)\n# param_3 = obj.count_unexpired_tokens(current_time)"}, {"value": "scala", "text": "Scala", "defaultCode": "class AuthenticationManager(_timeToLive: Int) {\n\n    def generate(tokenId: String, currentTime: Int): Unit = {\n        \n    }\n\n    def renew(tokenId: String, currentTime: Int): Unit = {\n        \n    }\n\n    def countUnexpiredTokens(currentTime: Int): Int = {\n        \n    }\n\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * val obj = new AuthenticationManager(timeToLive)\n * obj.generate(tokenId,currentTime)\n * obj.renew(tokenId,currentTime)\n * val param_3 = obj.countUnexpiredTokens(currentTime)\n */"}, {"value": "rust", "text": "Rust", "defaultCode": "struct AuthenticationManager {\n\n}\n\n\n/** \n * `&self` means the method takes an immutable reference.\n * If you need a mutable reference, change it to `&mut self` instead.\n */\nimpl AuthenticationManager {\n\n    fn new(timeToLive: i32) -> Self {\n        \n    }\n    \n    fn generate(&self, token_id: String, current_time: i32) {\n        \n    }\n    \n    fn renew(&self, token_id: String, current_time: i32) {\n        \n    }\n    \n    fn count_unexpired_tokens(&self, current_time: i32) -> i32 {\n        \n    }\n}\n\n/**\n * Your AuthenticationManager object will be instantiated and called as such:\n * let obj = AuthenticationManager::new(timeToLive);\n * obj.generate(tokenId, currentTime);\n * obj.renew(tokenId, currentTime);\n * let ret_3: i32 = obj.count_unexpired_tokens(currentTime);\n */"}, {"value": "racket", "text": "Racket", "defaultCode": "(define authentication-manager%\n  (class object%\n    (super-new)\n    \n    ; time-to-live : exact-integer?\n    (init-field\n      time-to-live)\n    \n    ; generate : string? exact-integer? -> void?\n    (define/public (generate token-id current-time)\n      )\n    ; renew : string? exact-integer? -> void?\n    (define/public (renew token-id current-time)\n      )\n    ; count-unexpired-tokens : exact-integer? -> exact-integer?\n    (define/public (count-unexpired-tokens current-time)\n      )))\n\n;; Your authentication-manager% object will be instantiated and called as such:\n;; (define obj (new authentication-manager% [time-to-live time-to-live]))\n;; (send obj generate token-id current-time)\n;; (send obj renew token-id current-time)\n;; (define param_3 (send obj count-unexpired-tokens current-time))"}, {"value": "erlang", "text": "Erlang", "defaultCode": "-spec authentication_manager_init_(TimeToLive :: integer()) -> any().\nauthentication_manager_init_(TimeToLive) ->\n  .\n\n-spec authentication_manager_generate(TokenId :: unicode:unicode_binary(), CurrentTime :: integer()) -> any().\nauthentication_manager_generate(TokenId, CurrentTime) ->\n  .\n\n-spec authentication_manager_renew(TokenId :: unicode:unicode_binary(), CurrentTime :: integer()) -> any().\nauthentication_manager_renew(TokenId, CurrentTime) ->\n  .\n\n-spec authentication_manager_count_unexpired_tokens(CurrentTime :: integer()) -> integer().\nauthentication_manager_count_unexpired_tokens(CurrentTime) ->\n  .\n\n\n%% Your functions will be called as such:\n%% authentication_manager_init_(TimeToLive),\n%% authentication_manager_generate(TokenId, CurrentTime),\n%% authentication_manager_renew(TokenId, CurrentTime),\n%% Param_3 = authentication_manager_count_unexpired_tokens(CurrentTime),\n\n%% authentication_manager_init_ will be called before every test case, in which you can do some necessary initializations."}, {"value": "elixir", "text": "Elixir", "defaultCode": "defmodule AuthenticationManager do\n  @spec init_(time_to_live :: integer) :: any\n  def init_(time_to_live) do\n    \n  end\n\n  @spec generate(token_id :: String.t, current_time :: integer) :: any\n  def generate(token_id, current_time) do\n    \n  end\n\n  @spec renew(token_id :: String.t, current_time :: integer) :: any\n  def renew(token_id, current_time) do\n    \n  end\n\n  @spec count_unexpired_tokens(current_time :: integer) :: integer\n  def count_unexpired_tokens(current_time) do\n    \n  end\nend\n\n# Your functions will be called as such:\n# AuthenticationManager.init_(time_to_live)\n# AuthenticationManager.generate(token_id, current_time)\n# AuthenticationManager.renew(token_id, current_time)\n# param_3 = AuthenticationManager.count_unexpired_tokens(current_time)\n\n# AuthenticationManager.init_ will be called before every test case, in which you can do some necessary initializations."}]
{
  "classname": "AuthenticationManager",
  "constructor": {
    "params": [
      {
        "type": "integer",
        "name": "timeToLive"
      }
    ]
  },
  "methods": [
    {
      "params": [
        {
          "type": "string",
          "name": "tokenId"
        },
        {
          "type": "integer",
          "name": "currentTime"
        }
      ],
      "name": "generate",
      "return": {
        "type": "void"
      }
    },
    {
      "params": [
        {
          "type": "string",
          "name": "tokenId"
        },
        {
          "type": "integer",
          "name": "currentTime"
        }
      ],
      "name": "renew",
      "return": {
        "type": "void"
      }
    },
    {
      "params": [
        {
          "type": "integer",
          "name": "currentTime"
        }
      ],
      "name": "countUnexpiredTokens",
      "return": {
        "type": "integer"
      }
    }
  ],
  "return": {
    "type": "boolean"
  },
  "systemdesign": true
}
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressSanitizer</a> is also enabled to help detect out-of-bounds and use-after-free bugs.</p>\r\n\r\n<p>Most standard library headers are already included automatically for your convenience.</p>"], "java": ["Java", "<p><code>OpenJDK 21</code>. Using compile arguments: <code>--enable-preview --release 21</code></p>\r\n\r\n<p>Most standard library headers are already included automatically for your convenience.</p>\r\n<p>Includes <code>Pair</code> class from https://docs.oracle.com/javase/8/javafx/api/javafx/util/Pair.html.</p>"], "python": ["Python", "<p><code>Python 2.7.18</code>.</p>\r\n\r\n<p>Most libraries are already imported automatically for your convenience, such as <a href=\"https://docs.python.org/2/library/array.html\" target=\"_blank\">array</a>, <a href=\"https://docs.python.org/2/library/bisect.html\" target=\"_blank\">bisect</a>, <a href=\"https://docs.python.org/2/library/collections.html\" target=\"_blank\">collections</a>. If you need more libraries, you can import it yourself.</p>\r\n\r\n<p>For Map/TreeMap data structure, you may use <a href=\"http://www.grantjenks.com/docs/sortedcontainers/\" target=\"_blank\">sortedcontainers</a> library.</p>\r\n\r\n<p>Note that Python 2.7 <a href=\"https://www.python.org/dev/peps/pep-0373/\" target=\"_blank\">is not maintained anymore</a>. For the latest Python, please choose Python3 instead.</p>"], "c": ["C", "<p>Compiled with <code>gcc 14</code> using the gnu11 standard.</p>\r\n\r\n<p>Your code is compiled with level one optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressSanitizer</a> is also enabled to help detect out-of-bounds and use-after-free bugs.</p>\r\n\r\n<p>Most standard library headers are already included automatically for your convenience.</p>\r\n\r\n<p>For hash table operations, you may use <a href=\"https://troydhanson.github.io/uthash/\" target=\"_blank\">uthash</a>. \"uthash.h\" is included by default. Below are some examples:</p>\r\n\r\n<p><b>1. Adding an item to a hash.</b>\r\n<pre>\r\nstruct hash_entry {\r\n    int id;            /* we'll use this field as the key */\r\n    char name[10];\r\n    UT_hash_handle hh; /* makes this structure hashable */\r\n};\r\n\r\nstruct hash_entry *users = NULL;\r\n\r\nvoid add_user(struct hash_entry *s) {\r\n    HASH_ADD_INT(users, id, s);\r\n}\r\n</pre>\r\n</p>\r\n\r\n<p><b>2. Looking up an item in a hash:</b>\r\n<pre>\r\nstruct hash_entry *find_user(int user_id) {\r\n    struct hash_entry *s;\r\n    HASH_FIND_INT(users, &user_id, s);\r\n    return s;\r\n}\r\n</pre>\r\n</p>\r\n\r\n<p><b>3. Deleting an item in a hash:</b>\r\n<pre>\r\nvoid delete_user(struct hash_entry *user) {\r\n    HASH_DEL(users, user);  \r\n}\r\n</pre>\r\n</p>"], "csharp": ["C#", "<p><a href=\"https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-13\" target=\"_blank\">C# 13</a> with .NET 9 runtime</p>"], "javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p>\r\n\r\n<p>For Priority Queue / Queue data structures, you may use 6.3.2 version of <a href=\"https://github.com/datastructures-js/priority-queue/tree/v6.3.2\" target=\"_blank\">datastructures-js/priority-queue</a> and 4.2.3 version of <a href=\"https://github.com/datastructures-js/queue/tree/v4.2.3\" target=\"_blank\">datastructures-js/queue</a> and 1.0.4 version of <a href=\"https://github.com/datastructures-js/deque/tree/v1.0.4\" target=\"_blank\">datastructures-js/deque</a>.</p>"], "ruby": ["Ruby", "<p><code>Ruby 3.2</code></p>\r\n\r\n<p>Some common data structure implementations are provided in the Algorithms module: https://www.rubydoc.info/github/kanwei/algorithms/Algorithms</p>"], "swift": ["Swift", "<p><code>Swift 6.0</code>.</p>\r\n\r\n<p>You may use the following packages:<br/>\r\n<a href=\"https://github.com/apple/swift-algorithms/tree/1.2.0\" target=\"_blank\">swift-algorithms 1.2.0</a><br/>\r\n<a href=\"https://github.com/apple/swift-collections/tree/1.1.4\" target=\"_blank\">swift-collections 1.1.4</a><br/>\r\n<a href=\"https://github.com/apple/swift-numerics/tree/1.0.2\" target=\"_blank\">swift-numerics 1.0.2</a></p>"], "golang": ["Go", "<p><code>Go 1.23</code></p>\r\n<p>Support <a href=\"https://pkg.go.dev/github.com/emirpasic/gods@v1.18.1\" target=\"_blank\">https://pkg.go.dev/github.com/emirpasic/gods@v1.18.1</a> and <a href=\"https://pkg.go.dev/github.com/emirpasic/gods/v2@v2.0.0-alpha\" target=\"_blank\">https://pkg.go.dev/github.com/emirpasic/gods/v2@v2.0.0-alpha</a> library.</p>"], "python3": ["Python3", "<p><code>Python 3.11</code>.</p>\r\n\r\n<p>Most libraries are already imported automatically for your convenience, such as <a href=\"https://docs.python.org/3/library/array.html\" target=\"_blank\">array</a>, <a href=\"https://docs.python.org/3/library/bisect.html\" target=\"_blank\">bisect</a>, <a href=\"https://docs.python.org/3/library/collections.html\" target=\"_blank\">collections</a>. If you need more libraries, you can import it yourself.</p>\r\n\r\n<p>For Map/TreeMap data structure, you may use <a href=\"http://www.grantjenks.com/docs/sortedcontainers/\" target=\"_blank\">sortedcontainers</a> library.</p>"], "scala": ["Scala", "<p><code>Scala 3.3.1</code>.</p>"], "kotlin": ["Kotlin", "<p><code>Kotlin 2.1.10</code>.</p>"], "rust": ["Rust", "<p><code>Rust 1.85.0</code>. Your code will be compiled with <code>opt-level</code> 2.</p>\r\n\r\n<p>Supports <a href=\"https://crates.io/crates/rand\" target=\"_blank\">rand v0.8</a> and <a href=\"https://crates.io/crates/regex\" target=\"_blank\">regex\u00a0v1</a> and <a href=\"https://crates.io/crates/itertools\" target=\"_blank\">itertools\u00a0v0.14</a> from crates.io</p>"], "php": ["PHP", "<p><code>PHP 8.2</code>.</p>\r\n<p>With bcmath module</p>"], "typescript": ["Typescript", "<p><code>TypeScript 5.7.3, Node.js 22.14.0</code>.</p>\r\n\r\n<p>Compile Options: <code>--alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2024</code></p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p>\r\n\r\n<p>For Priority Queue / Queue data structures, you may use 6.3.2 version of <a href=\"https://github.com/datastructures-js/priority-queue/tree/v6.3.2\" target=\"_blank\">datastructures-js/priority-queue</a> and 4.2.3 version of <a href=\"https://github.com/datastructures-js/queue/tree/v4.2.3\" target=\"_blank\">datastructures-js/queue</a> and 1.0.4 version of <a href=\"https://github.com/datastructures-js/deque/tree/v1.0.4\" target=\"_blank\">datastructures-js/deque</a>.</p>"], "racket": ["Racket", "<p><a href=\"https://docs.racket-lang.org/guide/performance.html#%28tech._c%29\" target=\"_blank\">Racket CS</a> v8.15</p>\r\n\r\n<p>Using <code>#lang racket</code></p>\r\n\r\n<p>Required <code>data/gvector data/queue data/order data/heap</code> automatically for your convenience</p>"], "erlang": ["Erlang", "Erlang/OTP 26"], "elixir": ["Elixir", "Elixir 1.17 with Erlang/OTP 26"], "dart": ["Dart", "<p>Dart 3.2. You may use package <a href=\"https://pub.dev/packages/collection/versions/1.18.0\" target=\"_blank\">collection</a></p>\r\n\r\n<p>Your code will be run directly without compiling</p>"]}
['Hash Table', 'Linked List', 'Design', 'Doubly-Linked List']