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
/** | |
* @param {string[]} words | |
* @param {number} maxWidth | |
* @return {string[]} | |
*/ | |
var fullJustify = function(words, maxWidth) { | |
let wordIndex = 0 | |
let justified = [] | |
let wordLengths = [] | |
while (wordIndex < words.length) { |
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
// this can be thrown into chrome dev tools to create a dummy file for testing | |
function createLargeFile(fileName, fileSizeInGB) { | |
const chunkSize = 1024 * 1024 * 10; // 10MB chunk size | |
let fileSize = fileSizeInGB * 1024 * 1024 * 1024; // Convert GB to bytes | |
let parts = []; | |
while (fileSize > 0) { | |
let size = Math.min(chunkSize, fileSize); | |
let part = new Uint8Array(size); | |
parts.push(part); |