4
\$\begingroup\$

Not exactly sure if it belongs in this site, but I always have trouble thinking of all the certain edge cases in any kind of competitive programming or puzzles.

For example, take this kind of problem

Find the size of the smallest list of squares that add up to n

f(16)-> 1 (16)
f(17)-> 2 (16+1)

One intuitive approach would be to take the largest square that fits into n, subtract, and taking the remainder and applying the function on that until n<4. This doesn't work as soon as you go to

f(18)-> 2 (9+9) rather than f(18)-> 3 (16+1+1)

While those edge cases may be easier to derive, many times edge cases will not be as intuitive. What are some general guidelines of finding such edge cases?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ This is not a programming challenge, but a question about programming challenges, so it should go on meta, I think. \$\endgroup\$ Commented Jun 6, 2019 at 23:15
  • 3
    \$\begingroup\$ @Grimy Personally I'd disagree, since meta is for questions about this site, not about questions about programming challenges. The tips tag is a good example of that kind of post being on topic here. However, I think this is irreparably broad as it is. If this were about a specific type of challenge or something, it might fit. Of course, for single challenges we have the sandbox to help with things like this. \$\endgroup\$ Commented Jun 6, 2019 at 23:21
  • 2
    \$\begingroup\$ I too think this might be better suited to Meta as it is about programming challenges; specifically how to think of edge cases. Unfortunately, I do also think it's too broad as there is no "catch-all" answer; edge cases are, in general, specific to each challenge. \$\endgroup\$ Commented Jun 6, 2019 at 23:43

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.