DEV Community

Discussion on: HackerRank Is Teaching You to Write Terrible Code

Collapse
 
colinmcgraw profile image
ColinMcGraw

I just ran into this issue myself after my first job hunt in 5 years, and even found that some of the answers for these type of sites are “wrong”. For instance, a problem asking you to ensure unique file naming given an array of file names:

FileName
FileName
FileName(1)

...the problem suggests appending “(#)” to the end. A more experienced programmer would write code to deliver a solution that produces the output:

FileName
FileName(2)
FileName(1)

...because it minimizes file name changes as a convenience to the user. However, the expected solution is actually:

FileName
FileName(1)
FileName(1)(1)

...and by the time you realize they asked for that contrived form of answer, the timer runs out and you’re left with an “incomplete” solution.

Of course, in the real world, a good programmer would question the requirement as written, but sites like HackerRank encourages blind, unquestioning adherence to written instructions even if it’s bad design.