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
| """Colab Pydantic Pickle Test""" | |
| from __future__ import annotations | |
| import io | |
| import types | |
| from typing import Union, get_args, get_origin | |
| from pydantic import BaseModel, create_model | |
| # The fix functions | |
| def clean_pydantic_model(model_cls, _cleaned_cache=None): |
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
| """Colab Pydantic Pickle Test""" | |
| from __future__ import annotations | |
| import io | |
| import types | |
| from typing import Union, get_args, get_origin | |
| from pydantic import BaseModel, create_model | |
| # The fix functions | |
| def clean_pydantic_model(model_cls, _cleaned_cache=None): |
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
| """Colab Pydantic Pickle Test""" | |
| from __future__ import annotations | |
| import io | |
| import types | |
| from typing import Union, get_args, get_origin | |
| from pydantic import BaseModel, create_model | |
| # The fix functions | |
| def clean_pydantic_model(model_cls, _cleaned_cache=None): |
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
| #!/usr/bin/env python3 | |
| """Test ellipsis syntax by executing UDFs and checking resulting column types""" | |
| import daft | |
| from daft import col | |
| # Create test dataframe | |
| df = daft.from_pydict({"values": [1.0, 2.0, 3.0]}) | |
| print("=== Testing list[type, ...] Ellipsis Syntax by Execution ===\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
| # Here is my Python implementation of the hash table data structure. | |
| # And here's my video where I talk about it in depth: https://youtu.be/sfWyugl4JWA | |
| class Hashtable: | |
| # Assumption: table_length is a prime number (for example, 5, 701, or 30011) | |
| def __init__(self, table_length): | |
| self.table = [None] * table_length | |
| ## An internal search function. | |
| # If it finds the given key in the table, it will return (True, index) | |
| # If not, it will return (False, the index where it would be inserted) |
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
| # My video where I talk about this data structure: https://youtu.be/sfWyugl4JWA | |
| class Hashtable: | |
| # Assumption: table_length is a prime number (for example, 5, 701, or 30011) | |
| def __init__(self, table_length): | |
| self.table = [None] * table_length | |
| ## An internal search function. | |
| # If it finds the given key in the table, it will return (True, index) | |
| # If not, it will return (False, the index where it would be inserted) |
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 ST: | |
| def build(self, arr): | |
| max_len = 4 * len(arr) | |
| self.st = [None] * max_len | |
| self.arr_len = len(arr) | |
| self.helper(arr, 1, 0, len(arr) - 1) | |
| def helper(self, arr, v, l, r): | |
| if l == r: | |
| self.st[v] = arr[l] |
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
| /** | |
| * @param {number[]} A | |
| * @return {boolean} | |
| */ | |
| var validMountainArray = function(A) { | |
| if (A.length < 3) { | |
| return false; | |
| } | |
| let i = 0; | |
| let j = 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
| /** | |
| * @param {number[]} nums | |
| * @return {boolean} | |
| */ | |
| var increasingTriplet = function(nums) { | |
| let currentMin = nums[0]; | |
| let minWithSmaller = Infinity; | |
| for (let i = 1; i < nums.length; i++) { | |
| if (nums[i] > minWithSmaller) { |
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
| /** | |
| * @param {number[]} A | |
| * @return {boolean} | |
| */ | |
| var validMountainArray = function(A) { | |
| if (A.length < 3) { | |
| return false; | |
| } | |
| let current = A[0]; | |
| let i = 1; |
NewerOlder