Easy Substring
CodeChefOpen on judge ↗
Given an array of ‘n’ elements which contains only 1 and 0, count all sub-array which starts and ends with same digit. Print the result. ###Input: - First line will contain $n$, size of array. - Next line will contain $n$ elements of the array. ###Output: single integer(count result) ###Constraints - $1 \leq n \leq 500$ - array elements: {0,1} ###Sample Input: 5
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.
Sign in to chat with the tutor and save your progress.
Sign in to start