Skip to content

Commit 0b26690

Browse files
committed
docs: mark done and eliminate created and update dates
1 parent c390a11 commit 0b26690

File tree

13 files changed

+12
-29
lines changed

13 files changed

+12
-29
lines changed

alternative/medium/number_of_islands.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ def dfs(i, j):
2424
return islands
2525

2626
"""
27-
Algorithm - Breadth First Search
28-
1. Iterate through the grid
29-
2. If the current element is 1, increment the count and call bfs
30-
3. In bfs, mark the current element as 0 and call bfs on all the adjacent elements
31-
4. Return the count
27+
Algorithm - DFS
28+
Time Complexity - O(M*N)
29+
Space Complexity - O(M*N)
30+
where M is the number of rows and N is the number of columns
31+
32+
Description:
33+
1. Iterate through each cell in the grid.
34+
2. If the cell is a '1', then it is the top-left corner of an island.
35+
3. Perform a DFS on the cell to mark all the cells in the island as '0'.
36+
4. Increment the number of islands and continue the search.
3237
"""
3338

3439
assert numIslands([["1","1","1","1","0"],

src/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
- [x] [167. Two sum II - input array is sorted](../src/medium/two_sum_ii_input_array_is_sorted.rs) -> [Problem Description](../src/medium/readme.md#167-two-sum-ii---input-array-is-sorted)
8383
- [x] [198. House robber](../src/medium/house_robber.rs) -> [Problem Description](../src/medium/readme.md#198-house-robber)
8484
- [x] [199. Binary tree right side view](../src/medium/binary_tree_right_side_view.rs) -> [Problem Description](../src/medium/readme.md#199-binary-tree-right-side-view)
85-
- [ ] [200. Number of islands](../src/medium/number_of_islands.rs) -> [Problem Description](../src/medium/readme.md#200-number-of-islands)
85+
- [x] [200. Number of islands](../src/medium/number_of_islands.rs) -> [Problem Description](../src/medium/readme.md#200-number-of-islands)
8686
- [x] [208. Implement trie (prefix tree)](../src/medium/implement_trie_prefix_tree.rs) -> [Problem Description](../src/medium/readme.md#208-implement-trie-prefix-tree)
8787
- [x] [211. Design add and search words data structure](../src/medium/design_add_and_search_words_data_structure.rs) -> [Problem Description](../src/medium/readme.md#211-design-add-and-search-words-data-structure)
8888
- [x] [213. House robber II](../src/medium/house_robber_ii.rs) -> [Problem Description](../src/medium/readme.md#213-house-robber-ii)

theory/categories/1.arrays_&_hashing/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,5 @@
9191
- [Hashing Techniques](https://www.geeksforgeeks.org/hashing-set-1-introduction/)
9292

9393
Category: `Arrays & Hashing`
94-
Created on: 2023-06-10 22:00:00
95-
Last modified on: 2023-06-10 22:00:00
9694
Status: Done
9795
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/2.stack/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,5 @@
6666
- [NeetCode](https://neetcode.io)
6767

6868
Category: `Stack`
69-
Created on: 2023-06-14 20:00:00
70-
Last modified on: 2023-06-22 19:00:00
7169
Status: Done
7270
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/2.two_pointers/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,5 @@
3131
- [x] [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/) | Hard | [Solution](../../../src/hard/trapping_rain_water.rs) | [Problem Description](../../../src/hard/readme.md#42-trapping-rain-water)
3232

3333
Category: `Two Pointers`
34-
Created on: 2023-06-22 19:10:00
35-
Last modified on: 2023-07-27 03:24:000
3634
Status: Done
3735
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/3.binary_search/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,5 @@
3737
- [x] [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/) | Hard | [Solution](../../../src/hard/median_of_two_sorted_arrays.rs) | [Problem Description](../../../src/hard/readme.md#4-median-of-two-sorted-arrays)
3838

3939
Category: `Binary Search`
40-
Created on: 2023-09-21 01:00
41-
Last modified on: 2023-10-5 20:32
4240
Status: Done
4341
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/3.linked_list/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,5 @@
4040
- [x] [Reverse Nodes in k-Group](https://leetcode.com/problems/reverse-nodes-in-k-group/) | Hard | [Solution](../../../src/hard/reverse_nodes_in_k_group.rs) | [Problem Description](../../../src/hard/readme.md#25-reverse-nodes-in-k-group)
4141

4242
Category: `Linked List`
43-
Created on: 2023-08-22 01:00:00
44-
Last modified on: 2023-10-11 17:30:00
4543
Status: Done
4644
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/3.sliding_windows/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,5 @@
3232
- [x] [Sliding Window Maximum](https://leetcode.com/problems/sliding-window-maximum/) | Hard | [Solution](../../../src/hard/sliding_window_maximum.rs)
3333

3434
Category: `Sliding Windows`
35-
Created on: 2023-07-28 15:14:00
36-
Last modified on: 2023-08-20 19:30:00
3735
Status: Done
3836
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/4.trees/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,5 @@
7777
- [ ] [Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/) | Hard | [Solution](../../../src/hard/serialize_and_deserialize_binary_tree.rs) | [Problem Description](../../../src/hard/readme.md#297-serialize-and-deserialize-binary-tree)
7878

7979
Category: `Trees`
80-
Created on: 2023-10-07 19:00
81-
Last modified on: 2023-10-31 02:50
8280
Status: In Progress
8381
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/5.backtracking/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,5 @@
3838
- [x] [N Queens](https://leetcode.com/problems/n-queens/) | Hard | [Solution](../../../src/hard/n_queens.rs) | [Problem Description](../../../src/hard/readme.md#51-n-queens)
3939

4040
Category: `Backtracking`
41-
Created on: 2023-10-31 03:01
42-
Last modified on: 2023-11-02 03:00
4341
Status: Done
4442
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/5.tries/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,5 @@
5858
- [x] [Word Search II](https://leetcode.com/problems/word-search-ii/) | Hard | [Solution](../../../src/hard/word_search_ii.rs) | [Problem Description](../../../src/hard/readme.md#212-word-search-ii)
5959

6060
Category: `Tries`
61-
Created on: 2023-10-31 03:00
62-
Last modified on: 2023-11-02 20:51
6361
Status: Done
6462
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/6.1d_dp/readme.md

-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,5 @@ Dynamic programming and greedy algorithms are similar. Both are optimization met
3434

3535

3636
Category: `Dynamic Programming`
37-
Created on: 2023-11-02 21:12
38-
Last modified on: 2023-11-04 22:17
3937
Status: Done
4038
Author: [David Bujosa](https://github.com/bujosa)

theory/categories/6.graphs/readme.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A graph can be implemented using an adjacency list or an adjacency matrix.
1515

1616
## Problems
1717

18-
- [ ] [Number of Islands](https://leetcode.com/problems/number-of-islands/) | Medium | [Solution](../../../src/medium/number_of_islands.rs) | [Problem Description](../../../src/medium/readme.md#200-number-of-islands)
18+
- [x] [Number of Islands](https://leetcode.com/problems/number-of-islands/) | Medium | [Solution](../../../src/medium/number_of_islands.rs) | [Problem Description](../../../src/medium/readme.md#200-number-of-islands)
1919
- [ ] [Clone Graph](https://leetcode.com/problems/clone-graph/) | Medium | [Solution](../../../src/medium/clone_graph.rs) | [Problem Description](../../../src/medium/readme.md#133-clone-graph)
2020
- [ ] [Max Area of Island](https://leetcode.com/problems/max-area-of-island/) | Medium | [Solution](../../../src/medium/max_area_of_island.rs) | [Problem Description](../../../src/medium/readme.md#695-max-area-of-island)
2121
- [ ] [Pacific Atlantic Water Flow](https://leetcode.com/problems/pacific-atlantic-water-flow/) | Medium | [Solution](../../../src/medium/pacific_atlantic_water_flow.rs) | [Problem Description](../../../src/medium/readme.md#417-pacific-atlantic-water-flow)
@@ -31,7 +31,5 @@ A graph can be implemented using an adjacency list or an adjacency matrix.
3131

3232

3333
Category: `Graphs`
34-
Created on: 2023-11-02 21:12
35-
Last modified on: 2023-11-04 22:20
3634
Status: In Progress
3735
Author: [David Bujosa](https://github.com/bujosa)

0 commit comments

Comments
 (0)