Nice! something to consider would be scanning the two arrays separately first to find the shortest and longest string, and then doing the comparison after.
The nested loops mean you're comparing every element against every other element, but notice that you really only have to compare the lengths of the longest and shortest string in each array, which you can find in a single pass on each array.
You compute strlen on each element in each comparison, and strlen isn't cached in C, so you'll see a bunch of redundant length counts.
Oh I think this one is my favourite!
This one is definitely the best.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
God love whoever voted this a best practise :D
This comment is hidden because it contains spoiler information about the solution
Nice! something to consider would be scanning the two arrays separately first to find the shortest and longest string, and then doing the comparison after.
Nice! A couple suggestions:
strlen
on each element in each comparison, and strlen isn't cached in C, so you'll see a bunch of redundant length counts.This comment is hidden because it contains spoiler information about the solution