File tree Expand file tree Collapse file tree 6 files changed +50
-6
lines changed
Expand file tree Collapse file tree 6 files changed +50
-6
lines changed Original file line number Diff line number Diff line change 11const fn = ( arr ) => {
2+ let window = 0
23 let ans = 0
3- let curr = 0
44 let left = 0
55
66 for ( let right = 0 ; right < arr . length ; right ++ ) {
7- // TODO: add arr[right] to curr
7+ // TODO: add arr[right] to window
88
99 while ( WINDOW_CONDITION_BROKEN ) {
10- // TODO: remove arr[left] from curr
10+ // TODO: remove arr[left] from window
1111 left ++
1212 }
1313
Original file line number Diff line number Diff line change 1+ function fn ( arr ) {
2+ let window = new Set ( )
3+ let ans = 0
4+ let left = 0
5+
6+ for ( let right = 0 ; right < arr . length ; right ++ ) {
7+ // TODO: add arr[right] to window
8+
9+ while ( WINDOW_CONDITION_BROKEN ) {
10+ // TODO: remove arr[left] from window
11+ left += 1
12+ }
13+
14+ // TODO: update ans
15+ }
16+
17+ return ans
18+ }
Original file line number Diff line number Diff line change 11def fn (arr ):
22 n = len (arr )
3+ window = 0
34 left = 0
4- curr = 0
55 ans = 0
66
77 for right in range (n ):
8- # TODO: add arr[right] to curr
8+ # TODO: add arr[right] to window
99
1010 while WINDOW_CONDITION_BROKEN :
11- # TODO: remove arr[left] from curr
11+ # TODO: remove arr[left] from window
1212 left += 1
1313
1414 # TODO: update ans
Original file line number Diff line number Diff line change 1+ def fn (arr ):
2+ window = set ()
3+ ans = 0
4+ left = 0
5+
6+ for right , ELEMENT in enumerate (arr ):
7+ # TODO: add arr[right] to window
8+
9+ while WINDOW_CONDITION_BROKEN :
10+ # TODO: remove arr[left] from window
11+ left += 1
12+
13+ # TODO: update ans
14+
15+ return ans
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export default function SidebarLinks() {
1919 </ Accordion >
2020 < Accordion title = "Hash Map" >
2121 < LinkWithTooltip href = "#hashmap-find-number-of-subarrays" description = "find number of subarrays that fit an exact criteria" />
22+ < LinkWithTooltip href = "#hashmap-sliding-window" description = "sliding window" />
2223 </ Accordion >
2324 < Accordion title = "Linked List" >
2425 < LinkWithTooltip href = "#linkedlist-fast-and-slow-pointer" description = "fast and slow pointer" />
Original file line number Diff line number Diff line change @@ -3,7 +3,11 @@ import styles from '@sections/section.module.sass'
33import Tabs from '@components/Tabs'
44
55import FindNumberOfSubarraysPY from '@code/python/hash_map/find_number_of_subarrays.py?raw'
6+ import SlidingWindowPY from '@code/python/hash_map/sliding_window.py?raw'
7+
8+
69import FindNumberOfSubarraysJS from '@code/javascript/hash_map/find_number_of_subarrays.js?raw'
10+ import SlidingWindowJS from '@code/javascript/hash_map/sliding_window.js?raw'
711
812
913export default function HashMap ( ) {
@@ -16,6 +20,12 @@ export default function HashMap() {
1620 < Tabs . Tab code = { FindNumberOfSubarraysJS } language = "javascript" />
1721 </ Tabs >
1822 </ section >
23+ < section id = "hashmap-sliding-window" >
24+ < Tabs title = "sliding window" >
25+ < Tabs . Tab code = { SlidingWindowPY } language = "python" />
26+ < Tabs . Tab code = { SlidingWindowJS } language = "javascript" />
27+ </ Tabs >
28+ </ section >
1929 </ div >
2030 )
2131}
You can’t perform that action at this time.
0 commit comments