Visitar URL original
Added solution for Project Euler problem 89. by fpringle · Pull Request #3105 · TheAlgorithms/Python · GitHub
The Wayback Machine - https://web.archive.org/web/20260219001833/https://github.com/TheAlgorithms/Python/pull/3105
Skip to content

Added solution for Project Euler problem 89. #3105

Closed
fpringle wants to merge 2 commits intoTheAlgorithms:masterfrom
fpringle:problem_89
Closed

Added solution for Project Euler problem 89. #3105
fpringle wants to merge 2 commits intoTheAlgorithms:masterfrom
fpringle:problem_89

Conversation

@fpringle
Copy link
Contributor

@fpringle fpringle commented Oct 9, 2020 •

Name: Roman numerals

For a number written in Roman numerals to be considered valid there are basic rules which must be followed. Even though the rules allow some numbers to be expressed in more than one way there is always a "best" way of writing a particular number.

For example, it would appear that there are at least six ways of writing the number sixteen:

IIIIIIIIIIIIIIII
VIIIIIIIIIII
VVIIIIII
XIIIIII
VVVI
XVI

However, according to the rules only XIIIIII and XVI are valid, and the last example is considered to be the most efficient, as it uses the least number of numerals.

The 11K text file, roman.txt (right click and 'Save Link/Target As...'), contains one thousand numbers written in valid, but not necessarily minimal, Roman numerals; see About... Roman Numerals for the definitive rules for this problem.

Find the number of characters saved by writing each of these in their minimal form.

Note: You can assume that all the Roman numerals in the file contain no more than four consecutive identical units.

Reference: https://projecteuler.net/problem=89
Reference: #2695

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@fpringle fpringle changed the title Added solution for Project Euler problem 89. Fixes: #2695 Added solution for Project Euler problem 89. Reference: #2695 Oct 9, 2020
@fpringle fpringle changed the title Added solution for Project Euler problem 89. Reference: #2695 Added solution for Project Euler problem 89. Oct 10, 2020
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Announcement:

@fpringle

This message is sent to all pull requests which are OPEN, NOT MERGED, not containing 'wontfix' label and contains 'Project Euler' or 'Project' or 'Euler' (case doesn't matter) in their title. If this message doesn't apply to your pull request, please ignore this.

Message:

This is to notify all the users submitting a pull request for the Project Euler solution that the README.md file has been updated with all the style requirements necessary for the directory and solution files. Please read through it and make all the necessary changes required to your submission.

@fpringle fpringle requested a review from Kush1101 as a code owner October 15, 2020 09:07
@fpringle
Copy link
Contributor Author

Can anyone tell me what the protocol is for importing data for Project Euler problems? I.e. for this problem there's a file contain a list of words that need to be analysed. At the moment I'm defining them in a list in a separate file data.py and then importing them, but Travis doesn't like that. Should I leave them as a .txt file and us open()? Or move the list into the sol1.py file?

@stale
Copy link

stale bot commented Nov 21, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Used to mark an issue or pull request stale. label Nov 21, 2020
@dhruvmanila
Copy link
Member

Hi, @fpringle please take a look at https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_054/sol1.py#L367-L369. If you have any doubts, feel free to post a comment tagging me.

@dhruvmanila
Copy link
Member

Closing and reopening the pull request to run the latest test configuration.

@dhruvmanila dhruvmanila reopened this Nov 21, 2020
@ghost ghost added the tests are failing Do not merge until tests pass label Nov 21, 2020
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Please use a .txt file instead.

@ghost ghost added the awaiting changes A maintainer has requested changes to this PR label Nov 21, 2020
@dhruvmanila dhruvmanila removed the stale Used to mark an issue or pull request stale. label Nov 22, 2020
@fpringle
Copy link
Contributor Author

Closing since there's already a solution for Problem 89.

@fpringle fpringle closed this Nov 27, 2020
@fpringle fpringle deleted the problem_89 branch November 27, 2020 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes A maintainer has requested changes to this PR tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments