Encrypt and Decrypt Strings
<p>You are given a character array <code>keys</code> containing <strong>unique</strong> characters and a string array <code>values</code> containing strings of length 2. You are also given another string array <code>dictionary</code> that contains all permitted original strings after decryption. You should implement a data structure that can encrypt or decrypt a <strong>0-indexed</strong> string.</p>

<p>A string is <strong>encrypted</strong> with the following process:</p>

<ol>
	<li>For each character <code>c</code> in the string, we find the index <code>i</code> satisfying <code>keys[i] == c</code> in <code>keys</code>.</li>
	<li>Replace <code>c</code> with <code>values[i]</code> in the string.</li>
</ol>

<p>Note that in case a character of the string is <strong>not present</strong> in <code>keys</code>, the encryption process cannot be carried out, and an empty string <code>&quot;&quot;</code> is returned.</p>

<p>A string is <strong>decrypted</strong> with the following process:</p>

<ol>
	<li>For each substring <code>s</code> of length 2 occurring at an even index in the string, we find an <code>i</code> such that <code>values[i] == s</code>. If there are multiple valid <code>i</code>, we choose <strong>any</strong> one of them. This means a string could have multiple possible strings it can decrypt to.</li>
	<li>Replace <code>s</code> with <code>keys[i]</code> in the string.</li>
</ol>

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

<ul>
	<li><code>Encrypter(char[] keys, String[] values, String[] dictionary)</code> Initializes the <code>Encrypter</code> class with <code>keys, values</code>, and <code>dictionary</code>.</li>
	<li><code>String encrypt(String word1)</code> Encrypts <code>word1</code> with the encryption process described above and returns the encrypted string.</li>
	<li><code>int decrypt(String word2)</code> Returns the number of possible strings <code>word2</code> could decrypt to that also appear in <code>dictionary</code>.</li>
</ul>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input</strong>
[&quot;Encrypter&quot;, &quot;encrypt&quot;, &quot;decrypt&quot;]
[[[&#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;d&#39;], [&quot;ei&quot;, &quot;zf&quot;, &quot;ei&quot;, &quot;am&quot;], [&quot;abcd&quot;, &quot;acbd&quot;, &quot;adbc&quot;, &quot;badc&quot;, &quot;dacb&quot;, &quot;cadb&quot;, &quot;cbda&quot;, &quot;abad&quot;]], [&quot;abcd&quot;], [&quot;eizfeiam&quot;]]
<strong>Output</strong>
[null, &quot;eizfeiam&quot;, 2]

<strong>Explanation</strong>
Encrypter encrypter = new Encrypter([[&#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;d&#39;], [&quot;ei&quot;, &quot;zf&quot;, &quot;ei&quot;, &quot;am&quot;], [&quot;abcd&quot;, &quot;acbd&quot;, &quot;adbc&quot;, &quot;badc&quot;, &quot;dacb&quot;, &quot;cadb&quot;, &quot;cbda&quot;, &quot;abad&quot;]);
encrypter.encrypt(&quot;abcd&quot;); // return &quot;eizfeiam&quot;. 
&nbsp;                          // &#39;a&#39; maps to &quot;ei&quot;, &#39;b&#39; maps to &quot;zf&quot;, &#39;c&#39; maps to &quot;ei&quot;, and &#39;d&#39; maps to &quot;am&quot;.
encrypter.decrypt(&quot;eizfeiam&quot;); // return 2. 
                              // &quot;ei&quot; can map to &#39;a&#39; or &#39;c&#39;, &quot;zf&quot; maps to &#39;b&#39;, and &quot;am&quot; maps to &#39;d&#39;. 
                              // Thus, the possible strings after decryption are &quot;abad&quot;, &quot;cbad&quot;, &quot;abcd&quot;, and &quot;cbcd&quot;. 
                              // 2 of those strings, &quot;abad&quot; and &quot;abcd&quot;, appear in dictionary, so the answer is 2.
</pre>

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

<ul>
	<li><code>1 &lt;= keys.length == values.length &lt;= 26</code></li>
	<li><code>values[i].length == 2</code></li>
	<li><code>1 &lt;= dictionary.length &lt;= 100</code></li>
	<li><code>1 &lt;= dictionary[i].length &lt;= 100</code></li>
	<li>All <code>keys[i]</code> and <code>dictionary[i]</code> are <strong>unique</strong>.</li>
	<li><code>1 &lt;= word1.length &lt;= 2000</code></li>
	<li><code>2 &lt;= word2.length &lt;= 200</code></li>
	<li>All <code>word1[i]</code> appear in <code>keys</code>.</li>
	<li><code>word2.length</code> is even.</li>
	<li><code>keys</code>, <code>values[i]</code>, <code>dictionary[i]</code>, <code>word1</code>, and <code>word2</code> only contain lowercase English letters.</li>
	<li>At most <code>200</code> calls will be made to <code>encrypt</code> and <code>decrypt</code> <strong>in total</strong>.</li>
</ul>

['implement-trie-prefix-tree', 'word-search-ii', 'implement-trie-ii-prefix-tree', 'find-the-sum-of-encrypted-integers']
[]
[{"value": "cpp", "text": "C++", "defaultCode": "class Encrypter {\npublic:\n    Encrypter(vector<char>& keys, vector<string>& values, vector<string>& dictionary) {\n        \n    }\n    \n    string encrypt(string word1) {\n        \n    }\n    \n    int decrypt(string word2) {\n        \n    }\n};\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * Encrypter* obj = new Encrypter(keys, values, dictionary);\n * string param_1 = obj->encrypt(word1);\n * int param_2 = obj->decrypt(word2);\n */"}, {"value": "java", "text": "Java", "defaultCode": "class Encrypter {\n\n    public Encrypter(char[] keys, String[] values, String[] dictionary) {\n        \n    }\n    \n    public String encrypt(String word1) {\n        \n    }\n    \n    public int decrypt(String word2) {\n        \n    }\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * Encrypter obj = new Encrypter(keys, values, dictionary);\n * String param_1 = obj.encrypt(word1);\n * int param_2 = obj.decrypt(word2);\n */"}, {"value": "python", "text": "Python", "defaultCode": "class Encrypter(object):\n\n    def __init__(self, keys, values, dictionary):\n        \"\"\"\n        :type keys: List[str]\n        :type values: List[str]\n        :type dictionary: List[str]\n        \"\"\"\n        \n\n    def encrypt(self, word1):\n        \"\"\"\n        :type word1: str\n        :rtype: str\n        \"\"\"\n        \n\n    def decrypt(self, word2):\n        \"\"\"\n        :type word2: str\n        :rtype: int\n        \"\"\"\n        \n\n\n# Your Encrypter object will be instantiated and called as such:\n# obj = Encrypter(keys, values, dictionary)\n# param_1 = obj.encrypt(word1)\n# param_2 = obj.decrypt(word2)"}, {"value": "python3", "text": "Python3", "defaultCode": "class Encrypter:\n\n    def __init__(self, keys: List[str], values: List[str], dictionary: List[str]):\n        \n\n    def encrypt(self, word1: str) -> str:\n        \n\n    def decrypt(self, word2: str) -> int:\n        \n\n\n# Your Encrypter object will be instantiated and called as such:\n# obj = Encrypter(keys, values, dictionary)\n# param_1 = obj.encrypt(word1)\n# param_2 = obj.decrypt(word2)"}, {"value": "c", "text": "C", "defaultCode": "\n\n\ntypedef struct {\n    \n} Encrypter;\n\n\nEncrypter* encrypterCreate(char* keys, int keysSize, char** values, int valuesSize, char** dictionary, int dictionarySize) {\n    \n}\n\nchar* encrypterEncrypt(Encrypter* obj, char* word1) {\n    \n}\n\nint encrypterDecrypt(Encrypter* obj, char* word2) {\n    \n}\n\nvoid encrypterFree(Encrypter* obj) {\n    \n}\n\n/**\n * Your Encrypter struct will be instantiated and called as such:\n * Encrypter* obj = encrypterCreate(keys, keysSize, values, valuesSize, dictionary, dictionarySize);\n * char* param_1 = encrypterEncrypt(obj, word1);\n \n * int param_2 = encrypterDecrypt(obj, word2);\n \n * encrypterFree(obj);\n*/"}, {"value": "csharp", "text": "C#", "defaultCode": "public class Encrypter {\n\n    public Encrypter(char[] keys, string[] values, string[] dictionary) {\n        \n    }\n    \n    public string Encrypt(string word1) {\n        \n    }\n    \n    public int Decrypt(string word2) {\n        \n    }\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * Encrypter obj = new Encrypter(keys, values, dictionary);\n * string param_1 = obj.Encrypt(word1);\n * int param_2 = obj.Decrypt(word2);\n */"}, {"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {character[]} keys\n * @param {string[]} values\n * @param {string[]} dictionary\n */\nvar Encrypter = function(keys, values, dictionary) {\n    \n};\n\n/** \n * @param {string} word1\n * @return {string}\n */\nEncrypter.prototype.encrypt = function(word1) {\n    \n};\n\n/** \n * @param {string} word2\n * @return {number}\n */\nEncrypter.prototype.decrypt = function(word2) {\n    \n};\n\n/** \n * Your Encrypter object will be instantiated and called as such:\n * var obj = new Encrypter(keys, values, dictionary)\n * var param_1 = obj.encrypt(word1)\n * var param_2 = obj.decrypt(word2)\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "class Encrypter {\n    constructor(keys: string[], values: string[], dictionary: string[]) {\n        \n    }\n\n    encrypt(word1: string): string {\n        \n    }\n\n    decrypt(word2: string): number {\n        \n    }\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * var obj = new Encrypter(keys, values, dictionary)\n * var param_1 = obj.encrypt(word1)\n * var param_2 = obj.decrypt(word2)\n */"}, {"value": "php", "text": "PHP", "defaultCode": "class Encrypter {\n    /**\n     * @param String[] $keys\n     * @param String[] $values\n     * @param String[] $dictionary\n     */\n    function __construct($keys, $values, $dictionary) {\n        \n    }\n  \n    /**\n     * @param String $word1\n     * @return String\n     */\n    function encrypt($word1) {\n        \n    }\n  \n    /**\n     * @param String $word2\n     * @return Integer\n     */\n    function decrypt($word2) {\n        \n    }\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * $obj = Encrypter($keys, $values, $dictionary);\n * $ret_1 = $obj->encrypt($word1);\n * $ret_2 = $obj->decrypt($word2);\n */"}, {"value": "swift", "text": "Swift", "defaultCode": "\nclass Encrypter {\n\n    init(_ keys: [Character], _ values: [String], _ dictionary: [String]) {\n        \n    }\n    \n    func encrypt(_ word1: String) -> String {\n        \n    }\n    \n    func decrypt(_ word2: String) -> Int {\n        \n    }\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * let obj = Encrypter(keys, values, dictionary)\n * let ret_1: String = obj.encrypt(word1)\n * let ret_2: Int = obj.decrypt(word2)\n */"}, {"value": "kotlin", "text": "Kotlin", "defaultCode": "class Encrypter(keys: CharArray, values: Array<String>, dictionary: Array<String>) {\n\n    fun encrypt(word1: String): String {\n        \n    }\n\n    fun decrypt(word2: String): Int {\n        \n    }\n\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * var obj = Encrypter(keys, values, dictionary)\n * var param_1 = obj.encrypt(word1)\n * var param_2 = obj.decrypt(word2)\n */"}, {"value": "dart", "text": "Dart", "defaultCode": "class Encrypter {\n\n  Encrypter(List<String> keys, List<String> values, List<String> dictionary) {\n    \n  }\n  \n  String encrypt(String word1) {\n    \n  }\n  \n  int decrypt(String word2) {\n    \n  }\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * Encrypter obj = Encrypter(keys, values, dictionary);\n * String param1 = obj.encrypt(word1);\n * int param2 = obj.decrypt(word2);\n */"}, {"value": "golang", "text": "Go", "defaultCode": "type Encrypter struct {\n    \n}\n\n\nfunc Constructor(keys []byte, values []string, dictionary []string) Encrypter {\n    \n}\n\n\nfunc (this *Encrypter) Encrypt(word1 string) string {\n    \n}\n\n\nfunc (this *Encrypter) Decrypt(word2 string) int {\n    \n}\n\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * obj := Constructor(keys, values, dictionary);\n * param_1 := obj.Encrypt(word1);\n * param_2 := obj.Decrypt(word2);\n */"}, {"value": "ruby", "text": "Ruby", "defaultCode": "class Encrypter\n\n=begin\n    :type keys: Character[]\n    :type values: String[]\n    :type dictionary: String[]\n=end\n    def initialize(keys, values, dictionary)\n        \n    end\n\n\n=begin\n    :type word1: String\n    :rtype: String\n=end\n    def encrypt(word1)\n        \n    end\n\n\n=begin\n    :type word2: String\n    :rtype: Integer\n=end\n    def decrypt(word2)\n        \n    end\n\n\nend\n\n# Your Encrypter object will be instantiated and called as such:\n# obj = Encrypter.new(keys, values, dictionary)\n# param_1 = obj.encrypt(word1)\n# param_2 = obj.decrypt(word2)"}, {"value": "scala", "text": "Scala", "defaultCode": "class Encrypter(_keys: Array[Char], _values: Array[String], _dictionary: Array[String]) {\n\n    def encrypt(word1: String): String = {\n        \n    }\n\n    def decrypt(word2: String): Int = {\n        \n    }\n\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * val obj = new Encrypter(keys, values, dictionary)\n * val param_1 = obj.encrypt(word1)\n * val param_2 = obj.decrypt(word2)\n */"}, {"value": "rust", "text": "Rust", "defaultCode": "struct Encrypter {\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 Encrypter {\n\n    fn new(keys: Vec<char>, values: Vec<String>, dictionary: Vec<String>) -> Self {\n        \n    }\n    \n    fn encrypt(&self, word1: String) -> String {\n        \n    }\n    \n    fn decrypt(&self, word2: String) -> i32 {\n        \n    }\n}\n\n/**\n * Your Encrypter object will be instantiated and called as such:\n * let obj = Encrypter::new(keys, values, dictionary);\n * let ret_1: String = obj.encrypt(word1);\n * let ret_2: i32 = obj.decrypt(word2);\n */"}, {"value": "racket", "text": "Racket", "defaultCode": "(define encrypter%\n  (class object%\n    (super-new)\n    \n    ; keys : (listof char?)\n    ; values : (listof string?)\n    ; dictionary : (listof string?)\n    (init-field\n      keys\n      values\n      dictionary)\n    \n    ; encrypt : string? -> string?\n    (define/public (encrypt word1)\n      )\n    ; decrypt : string? -> exact-integer?\n    (define/public (decrypt word2)\n      )))\n\n;; Your encrypter% object will be instantiated and called as such:\n;; (define obj (new encrypter% [keys keys] [values values] [dictionary dictionary]))\n;; (define param_1 (send obj encrypt word1))\n;; (define param_2 (send obj decrypt word2))"}, {"value": "erlang", "text": "Erlang", "defaultCode": "-spec encrypter_init_(Keys :: [char()], Values :: [unicode:unicode_binary()], Dictionary :: [unicode:unicode_binary()]) -> any().\nencrypter_init_(Keys, Values, Dictionary) ->\n  .\n\n-spec encrypter_encrypt(Word1 :: unicode:unicode_binary()) -> unicode:unicode_binary().\nencrypter_encrypt(Word1) ->\n  .\n\n-spec encrypter_decrypt(Word2 :: unicode:unicode_binary()) -> integer().\nencrypter_decrypt(Word2) ->\n  .\n\n\n%% Your functions will be called as such:\n%% encrypter_init_(Keys, Values, Dictionary),\n%% Param_1 = encrypter_encrypt(Word1),\n%% Param_2 = encrypter_decrypt(Word2),\n\n%% encrypter_init_ will be called before every test case, in which you can do some necessary initializations."}, {"value": "elixir", "text": "Elixir", "defaultCode": "defmodule Encrypter do\n  @spec init_(keys :: [char], values :: [String.t], dictionary :: [String.t]) :: any\n  def init_(keys, values, dictionary) do\n    \n  end\n\n  @spec encrypt(word1 :: String.t) :: String.t\n  def encrypt(word1) do\n    \n  end\n\n  @spec decrypt(word2 :: String.t) :: integer\n  def decrypt(word2) do\n    \n  end\nend\n\n# Your functions will be called as such:\n# Encrypter.init_(keys, values, dictionary)\n# param_1 = Encrypter.encrypt(word1)\n# param_2 = Encrypter.decrypt(word2)\n\n# Encrypter.init_ will be called before every test case, in which you can do some necessary initializations."}]
{
  "classname": "Encrypter",
  "constructor": {
    "params": [
      {
        "name": "keys",
        "type": "character[]"
      },
      {
        "type": "string[]",
        "name": "values"
      },
      {
        "name": "dictionary",
        "type": "string[]"
      }
    ]
  },
  "methods": [
    {
      "params": [
        {
          "type": "string",
          "name": "word1"
        }
      ],
      "name": "encrypt",
      "return": {
        "type": "string"
      }
    },
    {
      "params": [
        {
          "type": "string",
          "name": "word2"
        }
      ],
      "name": "decrypt",
      "return": {
        "type": "integer"
      }
    }
  ],
  "return": {
    "type": "boolean"
  },
  "systemdesign": true,
  "manual": false
}
{"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>"]}
['Array', 'Hash Table', 'String', 'Design', 'Trie']