I think ill have to count the number of correct matching alphabets in the array elements. its like matching the actual alphabet order. like got eg. “abode” the correct number of matches is 4 because a starts first in the alphabet order and b second, d fouth and e 5th. as for “o” he’s at the very back. same goes for the other words in the array.
you can see ///[4,3,1] i typed at the bottom of my code as the expected answer.
I’m trying to match the alphabets in the standard alphabetical order and if it matches, i increment by 1. that’s the n loop. once i’m done with n loop, i go back out to the j loop to go to the next alphabet of the word in the array. and once j loop is done. i push all the incremental points to the array as the first number which denotes how many alphabets has matched the alphabetical standard order in the first word. then after pushing, i go to the most outer loop ( i ) and i++, which gets me to the next word in the array and then repeat.
your n loop will loop through all the alphabet so it will find for sure a match, and so you will find the counter having just the length of the string
what’s the condition for which the counter should increase?
if you don’t mind can you help me out on this? String constructor - how can i pass?
looks like no one knows the answer yet and i certainly have no idea how to print strings without actually writing them down
I would just go through every string in the list with ‘for (i of )’ then with a for loop go through every char and change it to char code. If it is capital later i would subtract 65 (‘A’ in char code 65) or if it is small letter subtract 97. Then check result with for loop index (ex: i). If it match then we have found a match.Counting every match for every string we could solve this kata with less code and more efficient way. Just my initial thought.