Posts

Showing posts from September 28, 2021

HSL Colors Combination

Image
 HSL Colors Combination PROBLEM STATEMENT  Given string str which consists of only 3 letters representing the color,(H) Hue, (S) Saturation, (L) Lightness, called HSL colors. The task is to count the occurrence of ordered triplet “H, S, L” in a given string and give this count as the output. Boundary Condition: 1 <= len(str) <= 1000 Example Input/Output 1: Input: ( ) HHSL Output: 2 Explanation:  There are two triplets of RGB in the given string: => H at index 0, S at index 2, and L at index 3 form one triplet of HSL. => H at index 1, S at index 2, and L at index 3 forms the second triplet of HSL. Example Input/Output 2: Input: ( ) SHL Output: 0 Explanation:  No triplets exist.                                          1)     L EARN THRICE                      ...