Harder things

I have recently been testing my javascript skills out on codewars. This has been a very good tool to force me to learn new things and study different methods that can help solve problems.

I have moved on to try my hand at LeetCode, and I will say it is much more difficult to solve the problems on LeetCode as opposed to codewars. I am very grateful for how much I have grown with codewars, but LeetCode is a different kind of beast.

The first problem I tried my hand at was the problem called two sum. This problem asks that given an array of integers, and a target number, you are to find the integers in the array that add up to equal the target number, and return the indices of those integers in the array.

Quite a lot going on in this problem, however thanks to my understanding of nested loops, I was able to solve the problem in a brute force fashion. What I got hung up on was trying to find the answer based on the number in my initial index. Essentially, if my target number is 9 and my first number in my array is 2, I should automatically try to find an index with the number 7.

This did take me some time to understand, and there is a faster way to solve this problem involving key-value pairs set in an empty object that I am still trying to wrap my head around. What I have learned is that my time spent in codewars has prepared me to begin to work on problems like these. I am excited to see more complex problems that will force me to learn more complex methods.



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
Jr Medina

Jr Medina

Soon-to-be Flatiron School Successor, with an enthusiasm towards Front-End Web Development, lifelong learning, and continuous improvement.