Ruby Challenge!

What is a palindrome? A palindrome is something that is read the same forward as it is backwards.

For example,

  • racecar
  • kayak
  • my gym
  • Was it a cat I saw?
  • Step on no pets
  • 878
  • 123454321

Setup

  1. Fork and clone this repo
  2. cd racecar

Submission

  1. Commit
  2. Push up to your master
  3. Make a PR to Turingschool-examples with your name as the title

Your challenge:

During this hour, you will be challenged to review your raw ruby skills. Testing is not required.

Write a script in the palindrome.rb file that finds all numbers between 1 and 1000 that when reversed, and added to itself, create a numeric palindrome.

examples:

  • 50, because 50 + 05 = 55 and 55 is the same forward and backward
  • 47, because 47 + 74 = 121 and 121 is the same forward and backward
  • 513, because 513 + 315 = 828 and 828 is the same forward and backward

To run the code that you write in the palindrome.rb file, run ruby palindrome.rb.

Your return value should be similar to the following:

>> [1, 2, 3, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, 40, 41, 42, 43, 44, 45, 47, 50, 51, 52, 53, 54, 56, 60, 61, 62, 63, 65, 70, 71, 72, 74, 80, 81, 83, 90, 92, 100, 101, 102, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 216, 217, 220, 221, 222, 223, 224, 225, 226, 227, 230, 231, 232, 233, 234, 235, 236, 237, 240, 241, 242, 243, 244, 245, 246, 247, 300, 301, 302, 303, 304, 305, 306, 308, 310, 311, 312, 313, 314, 315, 316, 320, 321, 322, 323, 324, 325, 326, 330, 331, 332, 333, 334, 335, 336, 340, 341, 342, 343, 344, 345, 346, 400, 401, 402, 403, 404, 405, 407, 410, 411, 412, 413, 414, 415, 420, 421, 422, 423, 424, 425, 430, 431, 432, 433, 434, 435, 440, 441, 442, 443, 444, 445, 500, 501, 502, 503, 504, 506, 510, 511, 512, 513, 514, 520, 521, 522, 523, 524, 530, 531, 532, 533, 534, 540, 541, 542, 543, 544, 600, 601, 602, 603, 605, 610, 611, 612, 613, 620, 621, 622, 623, 630, 631, 632, 633, 640, 641, 642, 643, 700, 701, 702, 704, 710, 711, 712, 720, 721, 722, 730, 731, 732, 740, 741, 742, 800, 801, 803, 810, 811, 820, 821, 830, 831, 840, 841, 900, 902, 910, 920, 930, 940, 1000]