-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Labels
Description
Plus One Array Implementation in Cairo
π Description
Create an example that implements a solution to the "Plus One" problem in Cairo. This is a straightforward array manipulation problem where you need to add 1 to a number represented as an array of digits.
β Acceptance Criteria
- Create an
exercises/plus_onefolder inside scripts folder and there create a scarb project as the other scripts. - Implement a function that takes an array of digits representing a large integer and returns an array representing that integer + 1.
- The function should handle all edge cases:
- Regular increments (e.g., [1,2,3] β [1,2,4])
- Carry over (e.g., [1,2,9] β [1,3,0])
- Multiple carry overs (e.g., [9,9,9] β [1,0,0,0])
- Include comprehensive test cases covering the examples and edge cases.
- Document the implementation with clear explanations of the approach.
- Include a simple explanation of how array manipulation works in Cairo.
π References
π Additional Notes
- β Read our guidelines before applying.
- This is an entry-level exercise that introduces array manipulation in Cairo.
- Consider how to handle the case when the most significant digit has a carry (e.g., when incrementing 999).
- Think about the most gas-efficient way to implement this in Cairo.
Reactions are currently unavailable