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
def csv_to_markdown_table(csv_string): | |
""" | |
Convert a csv style string to a markdown table string. | |
Args: | |
csv_string: The csv style string to convert. | |
Returns: | |
The markdown table string. |
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 random | |
import string | |
def generate_slug(pattern='cvccvc-cvccvc-xxxxxx-cvccvc-000'): | |
""" Return something like 'pevqak-jaxkev-evryfd-IGyv-45v94' | |
given a pattern like: 'cvccvc-cvccvc-xxxxxx-XXxx-00x00' | |
""" | |
vowels = 'aeiou' | |
consonants = 'bcdfghjklmnpqrstvwxyz' |
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
""" | |
https://leetcode.com/problems/replace-words/submissions/1280805154/?envType=daily-question&envId=2024-06-07 | |
648. Replace Words | |
Medium | |
Topics | |
Companies | |
In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root "help" is followed by the word "ful", we can form a derivative "helpful". |
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
""" | |
https://leetcode.com/problems/roman-to-integer/description/ | |
13. Roman to Integer | |
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. | |
Symbol Value | |
I 1 | |
V 5 |
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
# https://leetcode.com/problems/unique-paths/description/ | |
""" | |
62. Unique Paths | |
Medium | |
Topics | |
Companies | |
There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time. |
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
""" | |
32. Longest Valid Parentheses | |
Hard | |
Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses | |
substring | |
Example 1: | |
Input: s = "(()" |
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 | |
class Solution: | |
def canJump(self, nums: List[int]) -> bool: | |
""" | |
55. Jump Game | |
You are given an integer array nums. | |
You are initially positioned at the array's first index, | |
and each element in the array represents your maximum jump length at that position. |