Skip to content

Commit 7391f0e

Browse files
authored
Update README.md
1 parent 9c37cc4 commit 7391f0e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 196-algorithm
2-
Implementation of the 196-algorithm to find palindromes in a predetermined sequence of instructions.
2+
Implementation of the 196-algorithm to find palindromes in a number sequence.
33

44
Inspired by https://www.youtube.com/watch?v=bN8PE3eljdA&t=374s
55

@@ -13,14 +13,15 @@ g++ main.cpp -o main
1313
./main
1414
```
1515
## Approach
16-
Given a number n we iteratively reassign n as the sum of previous n and the reverse of previous n until n is a palindrome.
16+
Given a number n we iteratively reassign to n the sum of n and the reverse of n until n is a palindrome.
1717

1818
Example Given:
1919
```
2020
n = 19 // no palindrome, iteration = 0
2121
n = 19 + 91 = 110 // no palindrome, iteration = 1
2222
n = 110 + 11 = 121 // palindrome, iteration = 2
2323
```
24+
Note, that n is of type int. This can result in exceeding the allocated storage size for larger n or higher iterations. To prevent you can set the datatype to long or a much larger datatype.
2425

2526
## Outcome
2627

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy