This file contains 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
app = FastAPI() | |
class Numbers(BaseModel): | |
numbers: List[float] | |
@app.post("/sum/") | |
async def sum_payload(nums: Numbers) -> JSONResponse: | |
"""Sum a list of numbers.""" | |
result = sum(nums.numbers) |
This file contains 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
{ | |
"public_identifier": "ericnessdata", | |
"profile_pic_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/ericnessdata/profile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20230528%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20230528T225639Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=fbeb1506bcd70a2ad22de7953eb24793afe65c5f6618ad47e0e15c293a28be75", | |
"background_cover_image_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/ericnessdata/cover?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20230528%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20230528T225639Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=20ed017262c2885e72c7539aefa906971fd3d529dad43dbc9a48581ed8ab437e", | |
"first_name": "Eric", | |
"last_name": "Ness", | |
"full_name": "Eric Ness", | |
"follower_count": 1554, | |
"occupation": "Principal Machine Learning Engineer at C.H. Robinson", | |
"headline": "Principal Machine |
This file contains 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 countSubstrings(self, s: str) -> int: | |
"""Find number of palindromic strings in s | |
Args: | |
s (str): String to analyze | |
Returns: | |
int: Count of palindromes | |
""" |
This file contains 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 countSubstrings(self, s: str) -> int: | |
"""Find number of palindromic strings in s | |
Args: | |
s (str): String to analyze | |
Returns: | |
int: Count of palindromes | |
""" |
This file contains 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 Optional | |
class ListNode: | |
def __init__(self, val=0, next=None): | |
self.val = val | |
self.next = next | |
class Solution: |
This file contains 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 Optional | |
class ListNode: | |
def __init__(self, val=0, next=None): | |
self.val = val | |
self.next = next | |
class Solution: |
This file contains 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
if current == head and node_to_remove == 0: | |
head = current.next | |
elif current.next: | |
current.next = current.next.next | |
else: | |
current.next = None |
This file contains 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 Optional | |
class ListNode: | |
def __init__(self, val=0, next=None): | |
self.val = val | |
self.next = next | |
class Solution: |
This file contains 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 collections | |
from enum import Enum | |
from typing import List, Set, Tuple | |
Node = collections.namedtuple("Node", "row col") | |
Direction = collections.namedtuple("Direction", "rows_down cols_right") | |
DIRECTIONS = [ | |
Direction(-1, 0), | |
Direction(1, 0), |
This file contains 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
_ ._ __/__ _ _ _ _ _/_ Recorded: 18:04:16 Samples: 277 | |
/_//_/// /_\ / //_// / //_'/ // Duration: 0.277 CPU time: 0.277 | |
/ _/ v4.1.1 | |
Program: 200_number_of_islands.py | |
0.277 <module> <string>:1 | |
[4 frames hidden] <string>, runpy | |
0.277 _run_code runpy.py:64 | |
└─ 0.277 <module> 200_number_of_islands.py:8 |
NewerOlder