Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| #mostly from https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjqkOKIodKAAxV3T0EAHbWTCxkQFnoECBIQAQ&url=https%3A%2F%2Fleetcode.com%2Fproblems%2Fx-of-a-kind-in-a-deck-of-cards%2Fsolutions%2F2857069%2Fpython-easy-solution-faster-than-99-22%2F&usg=AOvVaw0OEHJEjy6pL2XqRoSZTmAj&opi=89978449 | |
| #import collections | |
| class Solution: | |
| def hasGroupsSizeX(self, deck) -> bool: | |
| print(deck) | |
| #count = collections.Counter(deck) | |
| count = dict.fromkeys(deck,0) | |
| for card in deck: | |
| count[card]+=1 |
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(object): | |
| def reverseParentheses(s): | |
| if not s: | |
| return '' | |
| arr = [] | |
| for char in s: | |
| if char == ')': | |
| combine_str = '' | |
| while arr and arr[-1] != '(': |
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 canPlaceFlowers(self, flowerbed, n) -> bool: | |
| for i, flower in enumerate(flowerbed): | |
| if flower == 0 and (i == 0 or flowerbed[i - 1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0): | |
| flowerbed[i] = 1 | |
| n -= 1 | |
| if n <= 0: | |
| return True | |
| return False |
NewerOlder