Skip to content

Commit

Permalink
chore: update readme with problems
Browse files Browse the repository at this point in the history
  • Loading branch information
andrenbrandao committed Apr 9, 2022
1 parent 8f05060 commit 4823712
Show file tree
Hide file tree
Showing 28 changed files with 50 additions and 5 deletions.
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,46 @@

## Overview

These are my solutions to multiple algorithm problems. Most of them are from Leetcode or books.
These are my solutions to multiple algorithm problems. Most of them are from Leetcode, but others will be from other courses or books.

I have also created a directory to save my implementations of some [Data Structures](./data-structures/).

## Trees and Graphs

| # | Title | Solution | Difficulty | Platform |
|---|-------|----------|------------|----------|
| - | Maximum Common Prefix Between Any Two Words | [Python](./problems/trees-and-graphs/max_common_prefix.py) | - | - |
| 1584 | [Min Cost to Connect All Points](https://leetcode.com/problems/min-cost-to-connect-all-points/) | [Python](./problems/trees-and-graphs/min_cost_to_connect_all_points.py) | Medium | LeetCode |
| - | [Swap Nodes](https://www.hackerrank.com/challenges/swap-nodes-algo/problem) | [Python](./problems/trees-and-graphs/swap_nodes.py) | Medium | HackerRank |

## Recursion and Dynamic Programing

| # | Title | Solution | Difficulty | Platform |
|---|-------|----------|------------|----------|
| - | Add Digits Recursively | [Python](./problems/recursion-and-dp/add_digits.py) | - | - |
| - | All Possible Subsequences | [Python](./problems/recursion-and-dp/all_possible_subsequences.py) | - | - |
| - | Count Occurrences | [Python](./problems/recursion-and-dp/count_ocurrences.py) | - | - |
| - | H-Tree Construction | [Python](./problems/recursion-and-dp/h_tree.py) | - | Pramp |
| - | Has Adjacent Duplicates | [Python](./problems/recursion-and-dp/has_adjacent_duplicates.py) | - | - |
| - | KeyPad Combinations | [Python](./problems/recursion-and-dp/keypad_combinations.py) | - | - |
| - | Knapsack Combinations | [Python](./problems/recursion-and-dp/knapsack_combinations.py) | - | - |
| - | Min Cost Path Matrix | [Python](./problems/recursion-and-dp/min_cost_path_matrix.py) | - | - |
| - | N-Bits Booleans | [Python](./problems/recursion-and-dp/n_bits_booleans.py) | - | - |
| 51 | [N-Queens](https://leetcode.com/problems/n-queens/) | [Python](./problems/recursion-and-dp/n_queens.py) | Hard | LeetCode |
| 200 | [Number of Islands](https://leetcode.com/problems/number-of-islands/) | [Python](./problems/trees-and-graphs/number_of_islands.py) | Medium | LeetCode |
| 47 | [Permutations II](https://leetcode.com/problems/permutations-ii/) | [Python](./problems/recursion-and-dp/permutations_ii.py) | Medium | LeetCode |
| - | Possible Phrases | [Python](./problems/recursion-and-dp/possible_phrases.py) | - | - |
| - | Reverse String | [Python](./problems/recursion-and-dp/reverse_string.py) | - | - |
| 37 | [Sudoku Solver](https://leetcode.com/problems/sudoku-solver/) | [Python](./problems/recursion-and-dp/sudoku_solver.py) | Hard | LeetCode |
| 62 | [Unique Paths](https://leetcode.com/problems/unique-paths/) | [Python](./problems/recursion-and-dp/unique_paths.py) | Medium | LeetCode |
| - | Ways To Climb Stairs | [Python](./problems/recursion-and-dp/ways_to_climb_stairs.py) | - | - |
| 79 | [Word Search](https://leetcode.com/problems/word-search/) | [Python](./problems/recursion-and-dp/word_search.py) | Medium | LeetCode |

## NP-Complete

| # | Title | Solution | Difficulty | Platform |
|---|-------|----------|------------|----------|
| - | Set Covering Problem | [Python](./problems/np-complete/set_covering.py) | - | Grokking Algorithms Book |

## License

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
To find all the solutions, we just have to make a small modification to the Algorithm to
find the Number of Solutions below.
LeetCode 51. N-Queens
https://leetcode.com/problems/n-queens/
----
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
"""
LeetCode 37. Sudoku Solver
https://leetcode.com/problems/sudoku-solver/
Question also asked in Pramp.
---
Write the function `sudokuSolve` that checks whether a given sudoku board (i.e. sudoku puzzle) is solvable. If so, the function will returns `true`. Otherwise (i.e. there is no valid solution to the given sudoku board), returns `false`.
In sudoku, the objective is to fill a **9x9** board with digits so that each column, each row, and each of the nine **3x3** sub-boards that compose the board contains all of the digits from 1 to 9. The board setter provides a partially completed board, which for a well-posed board has a unique solution. **As explained above, for this problem, it suffices to calculate whether a given sudoku board has a solution. No need to return the actual numbers that make up a solution**.
Expand Down Expand Up @@ -107,10 +113,10 @@ def is_number_in_column(board, column, number):
[1,9,8] <-- (2,2) have to check from 0 to 2. Well, we have already cchecked for other numbers, so we do not need to.
We only need to check the next numbers inside the board.
position (4,1) has to be checked from (4,2), (5,0), (5,1) and (5,2)
position (4,1) has to be checked from (4,2), (5,0), (5,1) and (5,2)
rows
3 -> 0 + 3 -> 3 - 3 % 3 = 3
3 -> 0 + 3 -> 3 - 3 % 3 = 3
4 -> 1 + 3 -> 4 - 4 % 3 = 3
5 -> 2 + 3 -> 5 - 5 % 3 = 3
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4823712

Please sign in to comment.