Dhoni and the beautiful strings
CodeChefOpen on judge ↗
This time Dhoni has developed a passion for strings. Dhoni has an integer N and infinite supply of the characters 'A','B' and 'C'. Dhoni wants to know how many beautiful strings of length N can be generated by using these characters. A string is considered as beautiful if it does not have "ABC" as its substring. But he does not know how to code so he is asking you to help him. Since this number ma
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