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 abc import ABCMeta, abstractmethod | |
| from collections import defaultdict | |
| from datetime import datetime, timedelta | |
| import hashlib | |
| import threading | |
| # Design philosophy | |
| # Flow: | |
| # Client → CacheClient → ShardRouter → CacheNode → Storage | |
| # |
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
| """ | |
| Core Design Principles Used- Strategy Pattern | |
| Payment methods | |
| Notification channels | |
| Runtime polymorphism | |
| Loose coupling | |
| Extensible services | |
| User → Cart → Order → Payment → Notification | |
| """ |
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
| """ | |
| Use case components | |
| 1. Actors | |
| - Member (User) | |
| - Librarian (Admin) | |
| 2. Core Requirements (mapped to use-cases) | |
| - Search books | |
| - Issue / Return book | |
| - Reserve book | |
| - Add / Remove / Update book |
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
| """Main agent orchestrator for regression analysis.""" | |
| import logging | |
| from typing import Optional | |
| from regression_analyser.github_client import GitHubClient | |
| from regression_analyser.code_analyzer import CodeAnalyzer | |
| from regression_analyser.endpoint_mapper import EndpointMapper | |
| from regression_analyser.ai_agent import RegressionAnalyzerAgent | |
| from regression_analyser.comment_formatter import CommentFormatter |
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 abc import ABCMeta, abstractmethod | |
| from enum import Enum | |
| from typing import List, Optional | |
| # Enum Definitions | |
| RoomStyle = Enum("RoomStyle", "STANDARD DELUX SUITE") | |
| RoomStatus = Enum("RoomStatus", "AVAILABLE RESERVED NOT_AVAILABLE OCCUPIED SERVICE_IN_PROGRESS") | |
| BookingStatus = Enum("BookingStatus", "PENDING CONFIRMED CANCELED") |
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
| """ | |
| Given an array of integers A, return the largest integer that only occurs once. | |
| If no integer occurs once, return -1. | |
| Example 1: | |
| Input: [5,7,3,9,4,9,8,3,1] | |
| Output: 8 | |
| Explanation: |
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
| # Definition for singly-linked list. | |
| # class ListNode: | |
| # def __init__(self, val=0, next=None): | |
| # self.val = val | |
| # self.next = next | |
| class Solution: | |
| def isPalindrome(self, head: ListNode) -> bool: | |
| numbers = [] | |
| sentinel = head | |
| while sentinel: |
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
| """ | |
| Given an array of integers arr, return true if and only if it is a valid mountain array. | |
| Recall that arr is a mountain array if and only if: | |
| arr.length >= 3 | |
| There exists some i with 0 < i < arr.length - 1 such that: | |
| arr[0] < arr[1] < ... < arr[i - 1] < A[i] | |
| arr[i] > arr[i + 1] > ... > arr[arr.length - 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
| """ | |
| Implement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST): | |
| BSTIterator(TreeNode root) Initializes an object of the BSTIterator class. The root of the BST is given as part of | |
| the constructor. The pointer should be initialized to a non-existent number smaller than any element in the BST. | |
| boolean hasNext() Returns true if there exists a number in the traversal to the right of the pointer, otherwise | |
| returns false. | |
| int next() Moves the pointer to the right, then returns the number at the pointer. | |
| Notice that by initializing the pointer to a non-existent smallest number, the first call to next() will return the | |
| smallest element in the BST. |
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
| """ | |
| You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted | |
| in adjacent plots. | |
| Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, | |
| return if n new flowers can be planted in the flowerbed without violating the no-adjacent-flowers rule. | |
| Example 1: | |
| Input: flowerbed = [1,0,0,0,1], n = 1 | |
| Output: true |
NewerOlder