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
/** | |
* 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)); |
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 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) |
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
/** | |
* 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; |
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
/** | |
* 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; |
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
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. | |
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
// 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"; |
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
// 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 { |
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
{ | |
"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." |
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.
NewerOlder