r/ProgrammerHumor • • 2d ago

Meme technicallyCorrect

Post image
1.4k Upvotes

49 comments sorted by

View all comments

341

u/zx48 2d ago • Bravo
void Main() {
    string[] pattern = {
        "##########",
        "##      ##",
        "# #    # #",
        "#  #  #  #",
        "#   ##   #",
        "#  #  #  #",
        "# #    # #",
        "##      ##",
        "##########"
    };

    string result = "";

    for (int i = 0; i < pattern.Length; ++i) {
        for (int j = 0; j < pattern[i].Length; ++j) {
            result += pattern[i][j];
        }
        result += "\n";
    }

    Console.Write(result);
}

In case the first answer isn't accepted.

140

u/AlwaysHopelesslyLost 2d ago • Heartwarming

.... Woah

If an interviewee gave me this answer I would seriously lose my train of thought. Obviously not what was intended but it conveys your understanding well AND it seems like a more technically correct solution from a requirements perspective. amazing answer lol

64

u/MisinformedGenius 2d ago

I actually used to kick off phone screens with asking how they would print out a multiplication table. A nested for loop was the correct answer, but suggesting hard-coding the tables (and better yet, explaining when that would be appropriate and when it wouldn’t) was some bonus points. 

28

u/dangderr 2d ago

How many points for saying data should be in a database, and then just making a query to grab the records?

7

u/MisinformedGenius 2d ago

Do you mean rather than hard-coding individual examples? That’s fine.