Skip to content

Commit

Permalink
Fix: Repository Improvements: Naming Conventions, CI Checks, and Docu…
Browse files Browse the repository at this point in the history
…mentation Updates (#50)

This pull request fixes the formatting for the `collaboration/README.md`
file, what was wrong was mostly the lines being longer than 80
characters. Let's sure to respect this convention in the future.
  • Loading branch information
kamaraak authored Jan 10, 2025
2 parents c4fb0a0 + 7bdabed commit 49836da
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 141 deletions.
17 changes: 11 additions & 6 deletions collaboration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

---

Our group is committed to fostering a collaborative environment that values trust,
open communication, mutual respect, and the celebration of diverse perspectives.
Our group is committed to fostering a collaborative environment that values
trust, open communication, mutual respect, and the celebration of diverse
perspectives.

---

Expand Down Expand Up @@ -44,7 +45,8 @@ open communication, mutual respect, and the celebration of diverse perspectives.
, and successes.
- Show empathy and actively listen during discussions.
- Celebrate both individual and team achievements.
- Address trust issues respectfully and take steps to rebuild confidence if broken.
- Address trust issues respectfully and take steps to rebuild confidence if
broken.

---

Expand All @@ -53,7 +55,8 @@ open communication, mutual respect, and the celebration of diverse perspectives.
- Ensure everyone has an opportunity to speak and contribute.
- Avoid interrupting or dominating discussions.
- Critique ideas, not people, and provide constructive feedback.
- Show appreciation for all contributions and avoid dismissing ideas prematurely.
- Show appreciation for all contributions and avoid dismissing ideas
prematurely.

---

Expand All @@ -69,7 +72,8 @@ open communication, mutual respect, and the celebration of diverse perspectives.

- Revisit group norms periodically (preferably, monthly) to adapt to new
challenges or feedback.
- Allow flexibility for unforeseen circumstances but communicate changes promptly.
- Allow flexibility for unforeseen circumstances but communicate changes
promptly.

---

Expand All @@ -90,4 +94,5 @@ open communication, mutual respect, and the celebration of diverse perspectives.

---

Let’s stay committed to these norms to ensure a productive and enjoyable collaboration.
Let’s stay committed to these norms to ensure a productive and enjoyable
collaboration.
50 changes: 30 additions & 20 deletions collaboration/learning_goals.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,44 @@

## Collective

**1.Collaborative Coding**: Work together to develop efficient and innovative code
solutions to address real-world challenges.
**1. Collaborative Coding**:
Work together to develop efficient and innovative code solutions to address
real-world challenges.

**2.Code Review Skills**: Cultivate a constructive and effective peer-review process
to improve code quality and ensure best practices.
**2. Code Review Skills**:
Cultivate a constructive and effective peer-review process to improve code
quality and ensure best practices.

**3.Version Control Mastery**: Gain hands-on experience with Git and GitHub for
seamless collaboration, version control, and project management.
**3. Version Control Mastery**:
Gain hands-on experience with Git and GitHub for seamless collaboration,
version control, and project management.

**4.Team Communication**: Enhance teamwork and communication skills to ensure smooth
coordination and timely completion of tasks.
**4. Team Communication**:
Enhance teamwork and communication skills to ensure smooth coordination and
timely completion of tasks.

**5.Problem-Solving**: Address challenges creatively as a group by leveraging
diverse skills and perspectives.
**5. Problem-Solving**:
Address challenges creatively as a group by leveraging diverse skills and
perspectives.

## Individual

**1.Coding Proficiency**: Develop expertise in writing clean, efficient, and
functional code to contribute meaningfully to group projects.
**1. Coding Proficiency**:
Develop expertise in writing clean, efficient, and functional code to
contribute meaningfully to group projects.

**2.Feedback Skills**: Learn to provide and incorporate constructive feedback during
code reviews for continuous improvement.
**2. Feedback Skills**:
Learn to provide and incorporate constructive feedback during code reviews
for continuous improvement.

**3.Git and GitHub Skills**: Build individual proficiency in using Git commands and
GitHub workflows, including branching, merging, creating issues and resolving conflicts.
**3. Git and GitHub Skills**:
Build individual proficiency in using Git commands and GitHub workflows,
including branching, merging, creating issues, and resolving conflicts.

**4.Accountability**: Take responsibility for assigned tasks while meeting deadlines
and maintaining high-quality work.
**4. Accountability**:
Take responsibility for assigned tasks while meeting deadlines and
maintaining high-quality work.

**5.Adaptability**: Expand technical and collaborative skills by learning from peers
and adapting to project requirements.
**5. Adaptability**:
Expand technical and collaborative skills by learning from peers and
adapting to project requirements.
File renamed without changes.
76 changes: 66 additions & 10 deletions solutions/find_partitions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
"""
Module: Partition Finder
This module provides a function `find_partitions` that calculates all possible
partitions of a given number `n` using integers up to a specified maximum
value `max_num`. A partition of a number is a way of expressing it as a sum
of positive integers, regardless of order.
Behavior:
- The function uses recursion to explore all valid partitions of `n`.
- It ensures the partitions are unique and sorted.
- The implementation handles base cases for invalid inputs and recursively
builds partitions by including and excluding the current `max_num`.
Implementation:
1. Base cases:
- If `n` is negative or `max_num` is 0, return an empty list (no partitions).
- If `n` equals `max_num`, include the partition `[max_num]`.
2. Recursive calls:
- Find partitions including `max_num` by subtracting it from `n`.
- Find partitions excluding `max_num` by reducing `max_num`.
3. Combine results:
- Return all valid partitions by concatenating and sorting the partitions
from the above steps.
Example:
Input: n = 6, max_num = 4
Output: [[4, 2], [4, 1, 1], [3, 3], [3, 2, 1], [3, 1, 1, 1], [2, 2, 2],
[2, 2, 1, 1], [2, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]
"""


def find_partitions(n, max_num):
"""
Find all possible partitions of a number `n` using integers from 1 to `max_num`.
Expand All @@ -14,28 +46,52 @@ def find_partitions(n, max_num):
- list of lists: A list containing all partitions, where each partition is a
list of integers that sum to `n`. All numbers used are <= `max_num`.
"""
# Base case: If n is negative or max_num is 0, return an empty list
if n < 0 or max_num == 0:
return []

# Initialize a list for partitions that exactly match n
exact_match = []

# If n equals max_num, include the partition [max_num]
if n == max_num:
exact_match = [[max_num]]

# Find partitions that include max_num by subtracting it from n
with_max_num = [
partition + [max_num] for partition in find_partitions(n - max_num, max_num)
]

# Find partitions that exclude max_num by reducing max_num
without_max_num = find_partitions(n, max_num - 1)

# Return combined partitions: exact matches, with max_num, and without max_num
return sorted(exact_match) + sorted(with_max_num) + sorted(without_max_num)


# Example usage: Find partitions of 6 using numbers from 1 to 4
print(find_partitions(6, 4))
# Add test cases for the function
if __name__ == "__main__":
expected_result_case_1 = [
[1, 1, 4],
[2, 4],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 2],
[1, 1, 1, 3],
[1, 1, 2, 2],
[1, 2, 3],
[2, 2, 2],
[3, 3],
]
expected_result_case_2 = [
[1, 1, 3],
[2, 3],
[1, 1, 1, 1, 1],
[1, 1, 1, 2],
[1, 2, 2],
]
expected_result_case_3 = [[1, 1, 2], [2, 2], [1, 1, 1, 1]]
expected_result_case_4 = [[1, 1, 1]]
expected_result_case_5 = []
expected_result_case_6 = []

# Test cases for correctness
assert find_partitions(6, 4) == expected_result_case_1, "Test case 1 failed"
assert find_partitions(5, 3) == expected_result_case_2, "Test case 2 failed"
assert find_partitions(4, 2) == expected_result_case_3, "Test case 3 failed"
assert find_partitions(3, 1) == expected_result_case_4, "Test case 4 failed"
assert find_partitions(0, 5) == expected_result_case_5, "Test case 5 failed"
assert find_partitions(-1, 3) == expected_result_case_6, "Test case 6 failed"

print("All test cases passed!")
File renamed without changes.
105 changes: 0 additions & 105 deletions solutions/tests/test_find_partitons.py

This file was deleted.

0 comments on commit 49836da

Please sign in to comment.