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 DSU: | |
| def __init__(self, nodes : int): | |
| self.sizes = [1] * nodes | |
| self.parent = [i for i in range(nodes)] | |
| def find(self, node : int) -> int: | |
| if node != self.parent[node]: | |
| node = self.find(self.parent[node]) | |
| return self.parent[node] |
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
| const puppeteer = require('puppeteer'); | |
| const XLSX = require('xlsx'); | |
| const { NetworkConditions } = puppeteer; | |
| async function measureRequestTime(url, jsFileName, numberOfRuns, bandwidthMbps) { | |
| const timings = []; | |
| const networkConditions = { | |
| // Convert Mbps to bytes/second | |
| downloadThroughput: bandwidthMbps * 125000, | |
| uploadThroughput: bandwidthMbps * 125000, |
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 Strings { | |
| static reverse(str: string): string { | |
| if (str === null || str === undefined) | |
| throw new Error("empty or invalid string"); | |
| return str.split("").reverse().join(""); | |
| } | |
| static trimLeft(str: string): string { | |
| if (str === null || str === undefined) |
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
| const htmlString = `<div class="text" style="height : 10 ; width : 60;"> | |
| <div class="text" style="background : red;height : 10 ; width : 60;"> | |
| <div class="text" style="background : red;height : 10 ; width : 60;"></div></div></div>` | |
| const div = document.createElement('div'); | |
| div.innerHTML = htmlString; | |
| const getSelector = (root : HTMLElement, index: number) => { | |
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
| a |