Skip to content

Commit

Permalink
The Feast of Many Beasts (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
PheRum authored Jan 31, 2024
1 parent f8a330c commit ff1a0d3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 8kyu/Grasshopper - Summation/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Grasshopper - Summation

https://www.codewars.com/kata/55d24f55d7dd296eb9000030

Write a program that finds the summation of every number from 1 to num. The number will always be a positive integer greater than 0. Your function only needs to return the result, what is shown between parentheses in the example below is how you reach that result and it's not part of it, see the sample tests.

For example (Input -> Output):
Expand Down
9 changes: 9 additions & 0 deletions 8kyu/The Feast of Many Beasts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## The Feast of Many Beasts

https://www.codewars.com/kata/5aa736a455f906981800360d

All of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish must start and end with the same letters as the animal's name. For example, the great blue heron is bringing garlic naan and the chickadee is bringing chocolate cake.

Write a function feast that takes the animal's name and dish as arguments and returns true or false to indicate whether the beast is allowed to bring the dish to the feast.

Assume that beast and dish are always lowercase strings, and that each has at least two letters. beast and dish may contain hyphens and spaces, but these will not appear at the beginning or end of the string. They will not contain numerals.
3 changes: 3 additions & 0 deletions 8kyu/The Feast of Many Beasts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function feast(beast, dish) {
return beast.charAt(0) + beast.charAt(beast.length - 1) === dish.charAt(0) + dish.charAt(dish.length - 1);
}
7 changes: 7 additions & 0 deletions 8kyu/The Feast of Many Beasts/task.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('Tests', () => {
it('example', () => {
expect(feast("great blue heron", "garlic naan")).toBe(true);
expect(feast("chickadee", "chocolate cake")).toBe(true);
expect(feast("brown bear", "bear claw")).toBe(false);
});
});

0 comments on commit ff1a0d3

Please sign in to comment.