<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Arrays_&amp;_Hashing on Dmytro&#39;s Blog</title>
    <link>https://dmytros.blog/tags/arrays__hashing/</link>
    <description>Recent content in Arrays_&amp;_Hashing on Dmytro&#39;s Blog</description>
    <image>
      <title>Dmytro&#39;s Blog</title>
      <url>https://dmytros.blog/images/papermod-cover.png</url>
      <link>https://dmytros.blog/images/papermod-cover.png</link>
    </image>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 08 Jul 2026 09:41:21 +0300</lastBuildDate>
    <atom:link href="https://dmytros.blog/tags/arrays__hashing/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>LeetCode - Design HashSet</title>
      <link>https://dmytros.blog/posts/leetcode-design-hashset/</link>
      <pubDate>Wed, 08 Jul 2026 09:41:21 +0300</pubDate>
      <guid>https://dmytros.blog/posts/leetcode-design-hashset/</guid>
      <description>&lt;h3 id=&#34;the-problem&#34;&gt;The problem&lt;/h3&gt;
&lt;p&gt;Design a HashSet without using any built-in hash table libraries.&lt;/p&gt;
&lt;p&gt;Implement &lt;code&gt;MyHashSet&lt;/code&gt; class:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;void add(key)&lt;/code&gt; Inserts the value &lt;code&gt;key&lt;/code&gt; into the HashSet.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;bool contains(key)&lt;/code&gt; Returns whether the value &lt;code&gt;key&lt;/code&gt; exists in the HashSet.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;void remove(key)&lt;/code&gt; Removes the value &lt;code&gt;key&lt;/code&gt; from the HashSet. If &lt;code&gt;key&lt;/code&gt; does not exist in the HashSet, do nothing.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Input
[&amp;#34;MyHashSet&amp;#34;, &amp;#34;add&amp;#34;, &amp;#34;add&amp;#34;, &amp;#34;contains&amp;#34;, &amp;#34;contains&amp;#34;, &amp;#34;add&amp;#34;, &amp;#34;contains&amp;#34;, &amp;#34;remove&amp;#34;, &amp;#34;contains&amp;#34;]
[[], [1], [2], [1], [3], [2], [2], [2], [2]]
Output
[null, null, null, true, false, null, true, null, false]

Explanation
MyHashSet myHashSet = new MyHashSet();
myHashSet.add(1);      // set = [1]
myHashSet.add(2);      // set = [1, 2]
myHashSet.contains(1); // return True
myHashSet.contains(3); // return False, (not found)
myHashSet.add(2);      // set = [1, 2]
myHashSet.contains(2); // return True
myHashSet.remove(2);   // set = [1]
myHashSet.contains(2); // return False, (already removed)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
