When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
12 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
no I think you probably do want two for loops
the classic approach here (at least the expected one) is probably the double pointer or double index approach
though a dynamic programming solution also exists iirc
two for loops? someone said 3 for sure. but I don't know how to implement them
well, at least try something yourself first, then show us the code you tried
it would be against the server rules (Rule #5 specifically) to just hand you a solution
for (int i = 0; i < n; i++)
for (int j = i+1; j < n; j++)
Anyone can ask a question in our programming channels. Following the guide Writing The Perfect Question is recommended.
State your problem clearly and provide all necessary details:
Provide the relevant code in the message, and format it nicely with a code block*. If it's too much for one message, you can upload it:
please observe the common guidelines when asking
format your code, provide reasonably complete examples, specs, requirements, input/output/expectations, no screenshots, etc
like ok, this shows you know how to write two for loops, but doesn't seem to indicate you've actually tried to solve any part of the problem with this approach. you just wrote some code that resembles two loops