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
| #!/bin/bash | |
| # set_mtime_to_creation.sh | |
| # Sets each file's modification time to its creation time (macOS / BSD) | |
| shopt -s nullglob | |
| for file in *; do | |
| # Skip directories | |
| if [ -d "$file" ]; then | |
| continue |
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
| # Define Aurora Serverless v2 PostgreSQL cluster | |
| self.aurora_cluster = rds.DatabaseCluster( | |
| self, | |
| "AuroraServerlessCluster", | |
| engine=rds.DatabaseClusterEngine.aurora_postgres(version=rds.AuroraPostgresEngineVersion.VER_16_6), | |
| writer=rds.ClusterInstance.provisioned( | |
| "writer", instance_type=ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.LARGE) | |
| ), | |
| serverless_v2_min_capacity=0, # allow auto pause | |
| serverless_v2_max_capacity=8, |
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
| from typing import List, Tuple | |
| def bitstrToInt(bs: str) -> int: | |
| """Convert bitstring bs to an integer""" | |
| return int(bs, 2) | |
| def countBits(d: int) -> int: | |
| """Count the bits in d and return that value""" |
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 TimeInWordsError(Exception): | |
| pass | |
| def numberToString(d: int) -> str: | |
| """Number to string""" | |
| number_look = { | |
| 1: "one", | |
| 2: "two", |
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
| const MOVES = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]] | |
| function queensAttack(n: number, k: number, r_q: number, c_q: number, obstacles: number[][]): number { | |
| // Write your code here | |
| let spaces = 0 | |
| const obstacleSet = new Set(obstacles.map(o => `${o[0]},${o[1]}`)) | |
| const isvalidpos = (r: number, c: number) => { | |
| return r > 0 && r <= n && c > 0 && c <= n |
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
| function migratoryBirds(arr: number[]): number { | |
| // Write your code here | |
| let birdCount: { [key: number]: number} = {} | |
| let maxId = 0 | |
| let maxIdCount = 0 | |
| arr.forEach(bid => { | |
| if (birdCount[bid] !== undefined) { | |
| birdCount[bid]++ |
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
| from typing import Tuple | |
| class InvalidGame(Exception): | |
| def __init__(self, message): | |
| super().__init__(message) | |
| class Board: | |
| """N x N chessboard""" |
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
| import sys | |
| class SinglyLinkedListNode: | |
| def __init__(self, node_data): | |
| self.data = node_data | |
| self.next = None | |
| class SinglyLinkedList: |
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
| from typing import Tuple | |
| class CollatzChase: | |
| """ | |
| collatz sequence chase | |
| """ | |
| def __init__(self) -> None: | |
| """initialize""" |
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
| from collections import deque | |
| from typing import List, Tuple | |
| class Board: | |
| """ | |
| grid hopper | |
| starting at (1,1) must hope either down or right by the amount at grid 1,1 | |
| can you reach (size, size)? | |
| answer yes or now |
NewerOlder