added gitignore
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<!-- 2025-12-28 Sun 20:49 -->
|
||||
<!-- 2025-12-28 Sun 20:54 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>leetcode-arrays</title>
|
||||
@@ -407,9 +407,9 @@ All the numbers of nums are unique.
|
||||
Follow up: Could you implement a solution using only O(1) extra space complexity and O(n) runtime complexity?
|
||||
</p>
|
||||
</div>
|
||||
<div id="outline-container-orga4e1281" class="outline-3">
|
||||
<h3 id="orga4e1281"><a href="#orga4e1281">Attempt</a></h3>
|
||||
<div class="outline-text-3" id="text-orga4e1281">
|
||||
<div id="outline-container-orgad55f8f" class="outline-3">
|
||||
<h3 id="orgad55f8f"><a href="#orgad55f8f">Attempt</a></h3>
|
||||
<div class="outline-text-3" id="text-orgad55f8f">
|
||||
<p>
|
||||
Sort the array, loop through it and check via the incrementor
|
||||
</p>
|
||||
@@ -435,9 +435,9 @@ Problem here is that sort operation is O(nlogn) - too slow.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgf31a336" class="outline-3">
|
||||
<h3 id="orgf31a336"><a href="#orgf31a336">Solution</a></h3>
|
||||
<div class="outline-text-3" id="text-orgf31a336">
|
||||
<div id="outline-container-org9674e04" class="outline-3">
|
||||
<h3 id="org9674e04"><a href="#org9674e04">Solution</a></h3>
|
||||
<div class="outline-text-3" id="text-org9674e04">
|
||||
<p>
|
||||
One optimised solution:
|
||||
</p>
|
||||
@@ -515,9 +515,9 @@ n <code>= nums.length
|
||||
Follow up: Could you do it without extra space and in O(n) runtime? You may assume the returned list does not count as extra space.
|
||||
</p>
|
||||
</div>
|
||||
<div id="outline-container-org60e21be" class="outline-3">
|
||||
<h3 id="org60e21be"><a href="#org60e21be">Attempt</a></h3>
|
||||
<div class="outline-text-3" id="text-org60e21be">
|
||||
<div id="outline-container-org6ba1d2f" class="outline-3">
|
||||
<h3 id="org6ba1d2f"><a href="#org6ba1d2f">Attempt</a></h3>
|
||||
<div class="outline-text-3" id="text-org6ba1d2f">
|
||||
<p>
|
||||
Create a set, loop through the set (it wont have duplicate values), if the counter is not equal to the value in the set, add it to a new list.
|
||||
</p>
|
||||
@@ -594,9 +594,9 @@ Only one valid answer exists.
|
||||
Follow-up: Can you come up with an algorithm that is less than O(n2) time complexity?
|
||||
</p>
|
||||
</div>
|
||||
<div id="outline-container-orgad55f8f" class="outline-3">
|
||||
<h3 id="orgad55f8f"><a href="#orgad55f8f">Attempt</a></h3>
|
||||
<div class="outline-text-3" id="text-orgad55f8f">
|
||||
<div id="outline-container-orgad99534" class="outline-3">
|
||||
<h3 id="orgad99534"><a href="#orgad99534">Attempt</a></h3>
|
||||
<div class="outline-text-3" id="text-orgad99534">
|
||||
<p>
|
||||
Outer loop and inner loop
|
||||
</p>
|
||||
@@ -625,9 +625,9 @@ Bad as its O(N<sup>2</sup>)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org9674e04" class="outline-3">
|
||||
<h3 id="org9674e04"><a href="#org9674e04">Solution</a></h3>
|
||||
<div class="outline-text-3" id="text-org9674e04">
|
||||
<div id="outline-container-org902927a" class="outline-3">
|
||||
<h3 id="org902927a"><a href="#org902927a">Solution</a></h3>
|
||||
<div class="outline-text-3" id="text-org902927a">
|
||||
<p>
|
||||
Use a hashmap and loop once
|
||||
</p>
|
||||
@@ -657,7 +657,7 @@ After looking through the logic:
|
||||
</div>
|
||||
|
||||
|
||||
<div id="org9927624" class="figure">
|
||||
<div id="orge7a3750" class="figure">
|
||||
<p><img src="assets/swappy-20250805-152411.png" alt="swappy-20250805-152411.png" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user