Skip to content

Instantly share code, notes, and snippets.

@gstark
Last active October 15, 2015 15:19
Show Gist options
  • Save gstark/9d5b19f5b54a0732c108 to your computer and use it in GitHub Desktop.
Save gstark/9d5b19f5b54a0732c108 to your computer and use it in GitHub Desktop.

For the numbers 1 through 1000

  • if the number is divisible by 5 print Iron

  • if the number is divisible by 7, print Yard

  • if it is divisible by both 5 and 7, print IronYard

  • that is:

1
2
3
4
Iron
5
6
Yard
.
.
.

Given an array, create a new array that has all of the elements of the first array but in reverse order.

  • That is, given [5,4,9,1,2] return [2,1,9,4,5]

Write a method that given an array of strings, returns an array containing only the strings that are palindromes.

  • this is, given ["foo", "bar", "bazab", "Gavin", "barrab", "test"], returns only ["bazab", "barrab"]

Write a method that given a number returns the sum of the digits of that number

  • that is, given 1572, returns 15

Write a method to find all the numbers between 2 and 1000 that are squares

  • that is 4, 16, 25, ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment