#challenge
💻 Pentagonal Number | #easy
Write a function that takes a positive integer num and calculates how many dots exist in a pentagonal shape around the center dot on the Nth iteration.
In the image below you can see the first iteration is only a single dot. On the second, there are 6 dots. On the third, there are 16 dots, and on the fourth there are 31 dots.
Return the number of dots that exist in the whole pentagon on the Nth iteration.
Examples:
#interview
💻 Pentagonal Number | #easy
Write a function that takes a positive integer num and calculates how many dots exist in a pentagonal shape around the center dot on the Nth iteration.
In the image below you can see the first iteration is only a single dot. On the second, there are 6 dots. On the third, there are 16 dots, and on the fourth there are 31 dots.
Return the number of dots that exist in the whole pentagon on the Nth iteration.
Examples:
pentagonal(1) ➞ 1🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇
pentagonal(2) ➞ 6
pentagonal(3) ➞ 16
pentagonal(8) ➞ 141
#interview
#challenge
💻 Oddish vs. Evenish | #easy
Create a function that determines whether a number is Oddish or Evenish. A number is Oddish if the sum of all of its digits is odd, and a number is Evenish if the sum of all of its digits is even. If a number is Oddish, return "Oddish". Otherwise, return "Evenish".
For example, OddishOrEvenish(121) should return "Evenish", since 1 + 2 + 1 = 4. OddishOrEvenish(41) should return "Oddish", since 4 + 1 = 5.
Examples:
#interview
💻 Oddish vs. Evenish | #easy
Create a function that determines whether a number is Oddish or Evenish. A number is Oddish if the sum of all of its digits is odd, and a number is Evenish if the sum of all of its digits is even. If a number is Oddish, return "Oddish". Otherwise, return "Evenish".
For example, OddishOrEvenish(121) should return "Evenish", since 1 + 2 + 1 = 4. OddishOrEvenish(41) should return "Oddish", since 4 + 1 = 5.
Examples:
OddishOrEvenish(43) ➞ "Oddish"🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇
// 4 + 3 = 7
// 7 % 2 = 1
OddishOrEvenish(373) ➞ "Oddish"
// 3 + 7 + 3 = 13
// 13 % 2 = 1
OddishOrEvenish(4433) ➞ "Evenish"
// 4 + 4 + 3 + 3 = 14
// 14 % 2 = 0
#interview
#challenge
💻 Check for Anagrams | #easy
Create a function that takes two strings and returns either true or false depending on whether they're anagrams or not.
Examples:
#interview
💻 Check for Anagrams | #easy
Create a function that takes two strings and returns either true or false depending on whether they're anagrams or not.
Examples:
IsAnagram("cristian", "Cristina") ➞ true🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇
IsAnagram("Dave Barry", "Ray Adverb") ➞ true
IsAnagram("Nope", "Note") ➞ false
#interview