This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution: | |
| def isValid(self, s: str) -> bool: | |
| stack = [] | |
| opening_br = set(["{", "(", "["]) | |
| for ch in s: | |
| if ch in opening_br: | |
| stack.append(ch) | |
| else: | |
| if not stack: | |
| return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution: | |
| def isValid(self, s: str) -> bool: | |
| stack = [] | |
| opening_br = set(["{", "(", "["]) | |
| for ch in s: | |
| if ch in opening_br: | |
| stack.append(ch) | |
| else: | |
| if not stack: | |
| return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| token transform | |
| Write a function, token_transform, that takes in a dictionary of tokens and a string. In the dictionary, the replacement values for a token may reference other tokens. The function should return a new string where tokens are replaced with their fully evaluated string values. | |
| Tokens are enclosed in a pair of '$'. You can assume that the input string is properly formatted and "$" is not used in the string except to enclose a token. | |
| You may assume that there are no circular token dependencies. | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Created by new on 5/6/26. | |
| // | |
| #include <string> | |
| #include <unordered_map> | |
| #include <vector> | |
| #include <queue> | |
| #include <iostream> | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution: | |
| def numberOfPaths(self, grid: List[List[int]], k: int) -> int: | |
| mod = 1000000007 | |
| rows = len(grid) | |
| cols = len(grid[0]) | |
| dp = [[[0]*(2*k) for j in range(cols)] for j in range(rows)] | |
| for i in range(rows): | |
| for j in range(cols): | |
| val = grid[i][j] | |
| if i==0 and j==0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // 029PopoverBootcamp.swift | |
| // SwiftfulThinkingBeta | |
| // | |
| // Created by new on 9/27/25. | |
| // | |
| // Nick from Swiftful Thinking | |
| // https://www.youtube.com/watch?v=5QDvfNQF304 | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 916. Word Subsets | |
| Medium | |
| Companies | |
| You are given two string arrays words1 and words2. | |
| A string b is a subset of string a if every letter in b occurs in a including multiplicity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| 1475. Final Prices With a Special Discount in a Shop | |
| https://leetcode.com/problems/final-prices-with-a-special-discount-in-a-shop | |
| Easy | |
| You are given an integer array prices where prices[i] is the price of the ith item in a shop. | |
| There is a special discount for items in the shop. If you buy the ith item, then you will receive a discount equivalent to prices[j] where j is the minimum index such that j > i and prices[j] <= prices[i]. Otherwise, you will not receive any discount at all. | |
| Return an integer array answer where answer[i] is the final price you will pay for the ith item of the shop, considering the special discount. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| 2182. Construct String With Repeat Limit | |
| https://leetcode.com/problems/construct-string-with-repeat-limit | |
| Medium | |
| Hint | |
| You are given a string s and an integer repeatLimit. Construct a new string repeatLimitedString using the characters of s such that no letter appears more than repeatLimit times in a row. You do not have to use all characters from s. | |
| Return the lexicographically largest repeatLimitedString possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| 3264. Final Array State After K Multiplication Operations I | |
| https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-i | |
| Easy | |
| You are given an integer array nums, an integer k, and an integer multiplier. | |
| You need to perform k operations on nums. In each operation: |
NewerOlder