Hello, can anybody advise what Iam doing wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello, can anybody advise what Iam doing wrong?

Challenge: Find the highest word in string. Letter a=1, b=2, c=3... It reports me error but I do not know what is wrong. The same error happens in some of my programs. https://code.sololearn.com/cW4uyck57029/?ref=app

7th Aug 2022, 3:08 PM
TeaserCode
8 Answers
+ 2
Yes. Am not tested it fully.. But i may cause.. You can eliminate using of that array actually.. Use directly sum[i5] += value[i12++] ; Comment array declaration and use.. Try then..
7th Aug 2022, 6:24 PM
Jayakrishna 🇮🇳
+ 1
Where you testing this? That's may be because of your ide..! Error in path settings..! here : int value1[count+1][arr[i12].length()]; if arr[0] is not bigger word then you may go to access array value1 beyond its length...
7th Aug 2022, 3:24 PM
Jayakrishna 🇮🇳
+ 1
What is final compiler? What is your output? Am getting "taxi" but it's same if even if some other words have more length next... Did you try with different words? I think above array declaration may cause error .. Make sure array has enough length...
7th Aug 2022, 4:10 PM
Jayakrishna 🇮🇳
+ 1
I solve it, problem was in finding max element in sum array.
8th Aug 2022, 5:16 PM
TeaserCode
0
I try it on several online compiler and sololearn. And they print correct result. But when I try it on final compiler (whose challenge is) it report error. The point is not the longest word but highest sum of letters of every word if you convert them to succession numbers. Sorry can you be more precise.
7th Aug 2022, 3:59 PM
TeaserCode
0
Final compiler is compiler where I get this exercise. The way I chose is by convering original string into string array. I will add additional tests to test. So you ll see that all go correct.
7th Aug 2022, 4:21 PM
TeaserCode
0
Interesting: Test with first word is bigger..!!
7th Aug 2022, 5:26 PM
Jayakrishna 🇮🇳
0
Is it what you said at the beginning? Do you have any idea, how to solve it. I don't have it. It must be scope.
7th Aug 2022, 6:08 PM
TeaserCode