5 of my favourite CodeWars Kata’s for February 2017

jackLyons Uncategorized Tags: , ,
0
CodeWars Kata's

I highly recommend these CodeWars Kata’s for anyone wanting to improve their programming skills. It’s a great way to train your brain and stay sharp. It also is an excellent tool to practice new techniques, especially when learning new syntax (take ES6 / 7 as a fine example). The best part about it is, that when you complete a kata, you can review your work and compare it to other coders.
I think this is an awesome feature because it lets you see just how flexible your programming language can be, plus it adds a beautiful element of “artistic expression” to programming – allowing you to expand your creativity when solving problems.

Here are 5 of my favourite CodeWars Kata’s for Feb 2017:

    1. Sequence Generator – 7 Kyu

      This challenge asks you to implement function sequence, which returns new n-size Array filled according to pattern. Cloning data is an essential part of functional programming as it’s important not to mutate data. Cloning allows you to make alterations without negative consequences to your original data. Examples include:

      sequence(3, 4); // [4, 4, 4]
      sequence(5, []); // [[], [], [], [], []]
      sequence(2, "s"); // ["s", "s"]
      sequence(5, (x, idx) => idx%2) // [0, 1, 0, 1, 0];
      sequence(10, (x, idx) => idx+1) // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    2. String Scramble – 7 Kyu

      Given a string and an array of index numbers, return the characters of the string rearranged to be in the order specified by the accompanying array. This is a fun challenge that teaches you about manipulating items within an array.

    3. Coding Meetup #14 – Higher-Order Functions Series – Order the food – 7 Kyu

      I loved this challenge because it is exactly the problem we needed to solve at a past Angular 2 hack day! In this task you will be given an array of objects representing data about developers who have signed up to attend the next coding meetup that you are organising. Your task is to return an object which includes the count of food options selected by the developers on the meetup sign-up form..
      You need to turn this:

       
      var list1 = [
        { firstName: 'Noah', lastName: 'M.', country: 'Switzerland', continent: 'Europe', age: 19, language: 'C', 
          meal: 'vegetarian' },
        { firstName: 'Anna', lastName: 'R.', country: 'Liechtenstein', continent: 'Europe', age: 52, language: 'JavaScript', 
          meal: 'standard' },
        { firstName: 'Ramona', lastName: 'R.', country: 'Paraguay', continent: 'Americas', age: 29, language: 'Ruby', 
          meal: 'vegan' },
        { firstName: 'George', lastName: 'B.', country: 'England', continent: 'Europe', age: 81, language: 'C', 
          meal: 'vegetarian' },
      ];

       

      Into this:

       { vegetarian: 2, standard: 1, vegan: 1 }
    4. Fuel Calculator – 8 Kyu

      In this kata you will have to write a function called fuelPrice (fuel_price in PHP) that takes litres and pricePerLiter as arguments. Purchases of 2 or more litres get a discount of 5 cents per litre, purchases of 4 or more litres get a discount of 10 cents per litre, and so on every two litres, up to a maximum discount of 25 cents per litre. But total discount per liter cannot be more than 25 cents. round answer to 2 decimal places.

    5. Two Fighters, One Winner – 7 Kyu

      A great foray into Object Oriented Programming. In this example you must create a function that returns the name of the winner in a fight between two fighters. Each fighter takes turns attacking the other and whoever kills the other first is victorious. Death is defined as having health <= 0. Each fighter will be a Fighter object/instance. Both health and damagePerAttack (damage_per_attack for python) will be integers larger than 0.

 

I hope you enjoy these challenges! To compare your code with mine, simply add me as a friend.


The Web Developers Bootcamp.

A n00b friendly guide to becoming a pro!

If you’re feeling a bit overwhelmed and a little lost with all these crazy hard Free Code Camp exercises then this course is for you!

While I am oh so grateful for the opportunity to learn through Free Code Camp, I still find that learning to code alone and without proper guidance extremely exhausting. Which is why I’ve started to substitute my education with an incredible online resource called the Web Developers Bootcamp courtesy of Udemy.

This course has helped me brush off the cobwebs, unlearn my self-taught bad habits and gain a solid understanding of the true fundamentals of web development. It has helped me see why it is important to understand these JavaScript problems and how they apply to the real world.

This bootcamp will teach you how built beautiful sites with Bootstrap, add in functionality with JavaScript and write back end code with Node.js all in a series of short, sharp, no BS video modules. I seriously could not recommend it any higher. Check it out and let me know what you think 🙂

The Web Developers Bootcamp
The Web Developer Bootcamp.
The only course you need to learn web development – HTML, CSS, JS, Node, and More!

Sign up to receive up-to-date web tips, tricks and code hacks!