SarthakKeshari / CPP-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
47 stars 132 forks source link

Create palindromeNumber.cpp #487

Closed Meghwantsingh closed 2 years ago

Meghwantsingh commented 2 years ago

palindromeNumber.cpp file is added inside LeetCode folder

https://leetcode.com/problems/palindrome-number/

Choose your form and fill it -

1. Form 1(C++ Solution contributors)

2. Form 2(C++ Documentation Contributors)


1) Form 1

Issue Id you have worked upon -

https://github.com/Meghwantsingh/CPP-Questions-and-Solutions/new/main/LeetCode

Briefly explain your program logic -

Logic in palindrome a number is simple . suppose you have given number 321 then we can find the reverse of this number by take one number at a time from last position using % operator to find remainder and storing it in some variable which is multiple by 10 and added the reminder value so that no value left. Then divide the number n=n/10 so that previous last place value removed so that at a time when we are multiple by 10 it does not include. After this you get palindrome number 123 . then our function check and return true or false . Which is false bez 321 not equal to 123.

Screenshots(Attach 2 screenshots of your own input and output) -

https://drive.google.com/drive/u/0/folders/1qeMR2jb0cNwo5FxZvx1bEbKQvcB2E1OQ


Checklist:

Eg - If your code follow the below guidelines. Kindly change [] to [x]

All the conditions should be fulfilled for considering your code for merging -


2) Form 2

Issue Id you have worked upon -

https://leetcode.com/problems/palindrome-number/

Checklist:

Eg - If your code follow the below guidelines. Kindly change [] to [x]

All the conditions should be fulfilled for considering your Pull Request for merging -

SarthakKeshari commented 2 years ago

@Meghwantsingh, Kindly mention the proper issue id.