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

Added a palindrome module to the playground. #47

Merged
merged 20 commits into from
Apr 14, 2024
Merged

Conversation

tacosontitan
Copy link
Owner

@tacosontitan tacosontitan commented Apr 14, 2024

TL;DR

This PR adds support for new iterators, logical functions, and a dedicated module for solving the palindrome problem. This problem can be solved with a minimum of 6 + n bytes where n is the length of the input variable or literal:

Pal(121);

Reverse

This PR adds support for a generic reversal method that takes an input T, converts it to a string and then reverses the character sequence:

var testValue = "abc";
var reversedValue = Rev(testValue);
Console.WriteLine(reversedValue);

The output of the snippet above is:

cba

Equals Reversal

This PR also adds support for a method which invokes the aforementioned reversal and determines if the pre-reversed input is equal to the reversed output:

var testValue = 121;
var equalsReversal = testValue.EqRev();
Console.WriteLine(equalsReversal);

The output of the snippet above is:

true

@tacosontitan tacosontitan marked this pull request as ready for review April 14, 2024 15:24
@tacosontitan tacosontitan merged commit 6e9b082 into main Apr 14, 2024
2 checks passed
@tacosontitan tacosontitan deleted the leetcode/palindrome branch April 14, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant