← All problemsSign in

Valid Expression

CodeChefRating 1354Open on judge ↗

The correct way of evaluating an expression with $*, +,$ and $-$ is, first multiplication, then addition, and then subtraction. For example, the expression $2+3*7-5 = 2+21-5 = 23-5 = 18$. You are given integers $N$ and $X$. Your task is to generate a string $S$ of length $N$ consisting **only** of $*, +,$ and $-$ such that when these $N$ operators are placed in order between $(N+1)$ **ones**, the

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