Dusting Off Your Programming Fingers [DAY 2]


It’s day two and I am pumped. What’s exciting is that you don’t really know which challenge you’ll get since it’s random (or as close to random as it could get). So I wake up, with no idea of what kind of problem to solve [the unknown excites me] let’s just get to it shall we, Today’s challenge involves more strings this time calculate it’s strength here’s a screenshot of the problem

Okay so here’s the process I thought of

  1. split the string based on voles [maybe try Regex]
  2. get rid of dead strings
  3. figure out a way to give values to the alphabet
  4. start calculating the values and compare them with the max
  5. return max

so let’s get to it. I first wanted to check if I can split on an array and well …

._. okay let’s try out regex, I don’t know how to use it, and internet was scarce so I tried to guess the syntax and it was a pretty mess

and when the internet came so did the solution. I googled the syntax and bam it’s split!

okay let us remove that dead string, and start calculating! It shouldn’t be hard just looping through. I just took time to think of a way to represent the letters with numbers. At first, I thought of an object, but after a nap, I came up with a better idea, arrays!  Use their index for the number. and well started working and started testing the solution

umm, why isn’t it looping through the whole array? it’s just going through the first iteration. I started checking the code one more time. And then I realized. it had to do with using var i in both nested loops which caused the problem  [dope…] after that fix, It worked!

awesome now just at the max check aaaaand

yay! okay, the ultimate test comes now… checking it in codewars. so I submitted it and

YAY YAY YAY! [HAPPY DANCE!] okay day two added +10 to my confidence 🙂

Resources I used for this challenge:

Remove empty strings

Regex in strings

Array filter prototype

index of array function

How did your day go, did you do a coding challenge?

have a great day if you read thus far.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *