Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add burst balloons problem #2749

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

codec404
Copy link

@codec404 codec404 commented Oct 3, 2024

Description of Change

This PR implements the Burst Balloons problem using dynamic programming and memoization, encapsulated within the dynamic_programming::burst_balloons namespace. The algorithm maximizes coins obtained by strategically bursting balloons. Test cases based on the problem statement have been added to ensure correctness.

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:
This implementation addresses an optimal solution for the Burst Balloons problem (example inputs provided in test cases). It uses memoization to avoid recalculating overlapping subproblems and follows proper documentation practices using Doxygen-style comments.

This submission is intended to enhance the library’s dynamic programming section.

@realstealthninja realstealthninja added on hold Pull request is temporarily not reviewed dont-close This issue/pull request shouldn't be closed labels Oct 3, 2024
@realstealthninja
Copy link
Collaborator

Dynamic programming does not compile at the moment I'll review this soon but trying to get the ci fixed hope you understand

@realstealthninja realstealthninja added the awaiting review pull request is waiting to be reviewed label Oct 4, 2024
@realstealthninja realstealthninja changed the title UPDATE: Burst Balloons feat: add burst balloons problem Oct 4, 2024
Copy link
Collaborator

@realstealthninja realstealthninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contributions

Comment on lines +19 to +22
#include <iostream>
#include <vector>
#include <cassert>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These headers should be documented

#include <vector>
#include <cassert>

using namespace std;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using namespace std;

int expected_result3 = 9; // Expected output
int result3 = dynamic_programming::burst_balloons::maxCoins(nums3);
assert(result3 == expected_result3);
cout << "Test 3 passed: Maximum coins = " << result3 << endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add empty and negative test cases or use uint32_t as the parameter type

@realstealthninja realstealthninja added awaiting modification Do not merge until modifications are made and removed awaiting review pull request is waiting to be reviewed labels Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting modification Do not merge until modifications are made dont-close This issue/pull request shouldn't be closed on hold Pull request is temporarily not reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants