← All problemsSign in

4 Strings

Given two strings $S_1$ and $S_2$ , you have to print which string is lexicographically smaller. If string $S_1$ is smaller print $1$ else if $S_2$ is smaller print $2$ otherwise print $0$ , if both string are same. String $p$ is lexicographically smaller than string $q$, if $p$ is a prefix of $q$, is not equal to $q$ or there exists $i$, such that $p_i < q_i$ and for all $j < i$ it is satisfi

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