網頁

2024年9月19日 星期四

C++採Catalan數的遞迴DP方式計算Leetcode 241 Different Ways to Add Parentheses


C++採Catalan數的遞迴DP方式計算Leetcode 241  Different Ways to Add Parentheses
每個數字都是葉節點,而+、-、*操作則不是。算術公式的 dfs 走訪等價於其對應的帶括號的 inOrder 算式。
-----

2024年9月15日 星期日

Python C++ bitmask解Leetcode 1371 Find the Longest Substring Containing ...


Python C++ bitmask解Leetcode 1371  Find the Longest Substring Containing Vowels in Even Counts
建構一個容器first_seen[32](5個母音考慮2**5=32),它表示第一次看到的32不同bmask的索引
[Python code請進]
-----