Code Wars: How the Grinch Almost Ended Christmas

Thank you for visiting this post! Be sure to also take a look at my other work on LinkedIn, Github, and my website.

Oh. My. Goodness. I was so excited to solve this Algo. The Grinch has initiated an attack on the North Pole! We need to take out his Missiles before they hit the workshop and destroy all the gifts!

Who doesn’t love a good holiday themed ANYTHING?? Even if it means the possible destruction of the North Pole!

Let’s get started!


Please click the link below to view the Problem Statement


I start out by creating a for of loop so that I can access the elements of the missiles object. Using dot notation, I add a new {key: value}, with impact as the key, and the value = to the missiles distance / missiles speed. By doing this, I know what time each missile is scheduled to hit.

Then, I sort the object by the impact time, loop through the new sorted object of missiles and pushed the missile name into our answer array.

As always, here is a faster, optimal, one liner solution! This is not my code! I’ve linked the programmer’s CodeWars solution below. Please check him out!


Thank you so much for stopping by! Stay tuned for more Algorithm Content!

Please checkout my online portfolio and feel free to connect with me on Linkedin!





Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to root Huawei MediaPad tablet

Kubernetes : Spin Up Highly Available Kubernetes Cluster using kubeadm & Setup CNI | Part 3

The Inside-Out Application Security Opportunity with RASP by Signal Sciences

Easy and maintainable test data — The Kotlin way

Stratos Bi-Weekly Progress Report: July 21, 2021 — August 4, 2021


How to Make Your Very Own A.I. Chess Program! Part 1

Minimalist approach to using codex

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Stephanie Segura

Stephanie Segura

More from Medium

Classes and Instances in Object-Oriented Ruby : A Newbie’s Guide

LeetCode — 1306 Jump Game III javascript solution (faster than 100%)

I have Cleared My First Technical Interview, Feeling Proud! Wanna Know How?

End of my Flatiron School Journey