← All problemsSign in

Chef and Lines

Chef loves triangles, he draws $K$ lines (Numbered $1$ to $K$) on a paper. He is interested in counting the number of triangles made by the intersection of these lines. It is given that no three lines are concurrent and none of them are parallel to each other. Chef is busy in some other work, help Chef to count the number of triangles, and also find the number of intersections made by these lines.

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start