← All problemsSign in

Chef and His Habits

Chef has recently developed a habit of playing with numbers.One such day when he was playing he made a 2-D square matrix of numbers from 1 to N2 (where N is the number of rows and columns) in a sequential manner. He then wanted to know the sum of numbers diagonally to the bottom-right modulo 109+7 starting from any position of that matrix. For example, if N=3 then the matrix would appear as {(1,

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