916. Word Subsets
Instead of dictionary, we can use an array of 26. Every medium has it’s own easy and hard…
388. Longest Absolute File Path
思路 按大自然的写法不难,问题在于需要了解”\t” “\n”是一个字符而不是两个。以及比起从前往后数数,用lstrip更快。 贴图的写法要点:对于不同路径,depth字典是会变的,但相同路径没有影响。 Stack方法:0 – 0, 0.1 – 0, 0.1, 0.1.1 – 0, 0.1, 0.1.1, 0.1.2 – 0, 0.2 (计算深度,当深度小于栈尾时,代表进入了另一个路径,把非路径的pop出栈)- 0, 0.2, 0.2.1
2185. Counting Words With a Given Prefix
Just practice writing Trie.
3402. Minimum Operations to Make Columns Strictly Increasing
Easy makes me happy.
3403. Find the Lexicographically Largest String From the Box I
Not hard. Should be aware of Boarder Cases ( numFrends == 1)
3404. Count Special Subsequences
Point: Turn multiplication to fraction Hard to realize “for r in range(4, n – 2): q = r – 2” part.
2168. Unique Substrings With Equal Digit Frequency
Actually, brute force can work due to constrains. However, if we count the frequency every time, the time complexity will be O(n**3), which may…
1427. Perform String Shifts
Don’t forget mod when dealing with shifting. A negative number a: a % b = (a + b) % b Anyway, easy makes me…