❔ Code performance
Hi, I have this code, but unfortunately its not enough fast for the tests that my school given to me.
Can someone help me to make the code faster?
6 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
beolvasasElso read how many lines, and how many numbers in each line will be
meresekTesztelese upload a 2d array with NxM numbers, and then invite the vanMelegebb function on it
I guess that
vanMelegebb
is the most sus
Depends on how large n
is, the loops will execute a lot of times
Exponentially
Since inner loop executes n
times, and inside of it there's a loop that also executes n
times
So for n = 100
you get 10 000
executionswhat vanMelegebb function needs to do is check if a line(M numbers), is hotter than any other day in the matrix.
Hotter means each of the numbers is bigger than the others. And then it shall return the index of the line, if there are multiple solutions I have to return the smallest
if there is no solution, then I should return -1
I know, but i dont know any other ways to solve it
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.