Skip to content

Instantly share code, notes, and snippets.

View smatthewenglish's full-sized avatar
🌞

Sean Matt smatthewenglish

🌞
View GitHub Profile
/**
* The time complexity of the code is O(n^2), due to the nested stream operation.
*/
class Solution {
@Test
void test() {
List<Integer> departures = new ArrayList<>(Arrays.asList(26, 19, 19, 4, 4));
List<Integer> returns = new ArrayList<>(Arrays.asList(29, 26, 28, 19, 25));
from matplotlib import pyplot as plt
import matplotlib
from matplotlib.patches import Rectangle, Arrow
import matplotlib.lines as mlines
# UML Sequence Diagram for NFT Transaction Broadcast System
# Configurations
fig, ax = plt.subplots(figsize=(12, 8))
ax.set_xlim(0, 10)
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
@smatthewenglish
smatthewenglish / 0.java
Created November 1, 2023 16:14
501. Find Mode in Binary Search Tree
Given the root of a binary search tree (BST) with duplicates, return all the mode(s) (i.e., the most frequently occurred element) in it.
If the tree has more than one mode, return them in any order.
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than or equal to the node's key.
The right subtree of a node contains only nodes with keys greater than or equal to the node's key.
Both the left and right subtrees must also be binary search trees.
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
pragma abicoder v2;
import {Test, console2} from "forge-std/Test.sol";
import {UniswapV3Twap, IUniswapV3Pool} from "../src/UniswapV3Twap.sol";
import {TickMath} from "@uniswap/v3-core/contracts/libraries/TickMath.sol";
import {FullMath} from "@uniswap/v3-core/contracts/libraries/FullMath.sol";
import {FixedPoint96} from "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol";
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { Ownable2Step } from "../lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol";
import { ReentrancyGuard } from "../lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol";
///@dev values for MONTHS and YEARS not included because they're not uniform
enum TimeUnit{ MINUTES, HOURS, DAYS, WEEKS }
interface IFixedWindowOracle {
{
"property_address": "1600 Pennsylvania Avenue NW, Washington, DC 20500",
"current_value": "100.00",
"last_sale_date": "1691446461",
"last_sale_price": "1.00",
"year_built": 1800,
"square_feet": 55000,
"bedrooms": 16,
"bathrooms": 35,
"description": "Charming neoclassical gem nestled in the heart of Washington D.C."
@smatthewenglish
smatthewenglish / baslineX.svg
Created February 28, 2023 23:30
generalized version
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.