LeetCode Daily Challenge: Happy Strings

LeetCode POTD šŸ’«: Description: AĀ happy stringĀ is a string that: -> consists only of letters of the setĀ ['a', 'b', 'c']. -> s[i] != s[i + 1]Ā for all values ofĀ iĀ fromĀ 1Ā toĀ s.length - 1Ā (string is 1-indexed). For example, stringsĀ "abc", "ac", "b"Ā andĀ "abcbabcbcb"Ā are all happy strings and stringsĀ "aa", "baa"Ā andĀ "ababbc"Ā are not happy strings. Given two integersĀ nĀ andĀ k, consider a list of all happy strings of lengthĀ nĀ sorted in lexicographical order. ReturnĀ the kth stringĀ of this list or return anĀ empty stringĀ if there are less thanĀ kĀ happy strings of lengthĀ n. Here's my solution: https://lnkd.in/gEe77wac #Python #DSA #Leetcode #DailyChallenge #Recursion

  • graphical user interface, text, application, email

To view or add a comment, sign in

Explore content categories