Skip to content

Commit f7c3127

Browse files
Zanger67/leetcodeZanger67/leetcode
authored andcommitted
Updated markdown files
1 parent 4d502e7 commit f7c3127

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

markdowns/_1415. The k-th Lexicographical String of All Happy Strings of Length n.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class Solution:
4444
lambda rem, n, output:
4545
''.join(output) if not n else
4646
_pm_dfs(
47-
rem - (pot_per_path if (temp := int(rem > (pot_per_path := 2 ** (n - 1)))) else 0),
47+
rem - (pot_per_path if (indx := int(rem > (pot_per_path := 2 ** (n - 1)))) else 0),
4848
n - 1,
49-
output + ['abc'.replace(output[-1], '')[temp]]
49+
output + ['abc'.replace(output[-1], '')[indx]]
5050
)
5151
)
5252
)(
@@ -61,7 +61,7 @@ class Solution:
6161
```Python
6262
class Solution:
6363
def getHappyString(self, n: int, k: int) -> str:
64-
return (_pm_dfs := (lambda rem, n, output: ''.join(output) if not n else _pm_dfs(rem - (pot_per_path if (temp := int(rem > (pot_per_path := 2 ** (n - 1)))) else 0), n - 1, output + ['abc'.replace(output[-1], '')[temp]])))(k - x * pot_n_min_1,n, [chr(ord('a') + x)]) if (x := (k - 1) // (pot_n_min_1 := 2 ** (n := n - 1))) <= 2 else ''
64+
return (_pm_dfs := (lambda rem, n, output: ''.join(output) if not n else _pm_dfs(rem - (pot_per_path if (indx := int(rem > (pot_per_path := 2 ** (n - 1)))) else 0), n - 1, output + ['abc'.replace(output[-1], '')[indx]])))(k - x * pot_n_min_1,n, [chr(ord('a') + x)]) if (x := (k - 1) // (pot_n_min_1 := 2 ** (n := n - 1))) <= 2 else ''
6565
```
6666

6767
#### [m1415.py](<../my-submissions/m1415.py>)

0 commit comments

Comments
 (0)