Skip to content

feat: Adiciona solução TDD para problema 8 (atoi) na liguagem python #506

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarcusVcd
Copy link

Pull Request Template

Description

This PR adds a TDD-based solution for the LeetCode problem #8, "String to Integer (atoi)", implemented in Python.

The solution iteratively processes the string, handling leading whitespace, optional signs, and numerical digits, while also managing 32-bit integer overflow and underflow conditions as required by the problem description.

Problem Link: https://leetcode.com/problems/string-to-integer-atoi/

Put check marks:

  • Have you made changes in README file ?
  • Added problem & solution under correct topic.
  • Specified Space & Time complexity.
    • Time Complexity: O(n), where n is the length of the string, as we do a single pass.
    • Space Complexity: O(1), as we only use a few variables to store state.
  • Specified difficulty level, tag & Note(if any).
    • Difficulty: Medium
    • Tags: String, Math

How Has This Been Tested?

The solution was developed using Test-Driven Development (TDD). A suite of unit tests was created using pytest to verify each piece of functionality incrementally. The tests cover:

  • Basic positive integer conversion.
  • Handling of leading whitespace and signs (+/-).
  • Correctly stopping at non-digit characters.
  • Clamping to INT_MAX on overflow.
  • Clamping to INT_MIN on underflow.

Make sure all below guidelines are followed else PR will get Reject:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code so that it is easy to understand
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Copy link

welcome bot commented Jul 9, 2025

I can tell this is your first pull request! Thank you I'm so honored. 🎉🎉🎉 I'll take a look at it ASAP!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant