Skip to content

Commit 4d502e7

Browse files
committed
misc
1 parent bf6c7e7 commit 4d502e7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

my-submissions/m1415 v2 cursed oneliner expanded.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ def getHappyString(self, n: int, k: int) -> str:
55
lambda rem, n, output:
66
''.join(output) if not n else
77
_pm_dfs(
8-
rem - (pot_per_path if (temp := int(rem > (pot_per_path := 2 ** (n - 1)))) else 0),
8+
rem - (pot_per_path if (indx := int(rem > (pot_per_path := 2 ** (n - 1)))) else 0),
99
n - 1,
10-
output + ['abc'.replace(output[-1], '')[temp]]
10+
output + ['abc'.replace(output[-1], '')[indx]]
1111
)
1212
)
1313
)(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class Solution:
22
def getHappyString(self, n: int, k: int) -> str:
3-
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 ''
3+
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 ''

0 commit comments

Comments
 (0)