Skip to content

Instantly share code, notes, and snippets.

View shotah's full-sized avatar

Christopher Blodgett shotah

  • Seattle, WA
  • 23:39 (UTC -08:00)
View GitHub Profile
@shotah
shotah / gist:2dc1b93696a585a982d7fc7fb30dc153
Created November 22, 2022 19:33
1926. Nearest Exit from Entrance in Maze
class Node:
def __init__(self, location: list[int] = None):
self.location = location
self.north: Node = self
self.east: Node = self
self.south: Node = self
self.west: Node = self
class Solution:
function fullJustify(words: string[], maxWidth: number): string[] {
let result: string[] = [];
let currentLineLength: number = 0;
let currentLineWords: string[] = [];
let currentSpaces: number = 0;
for (let i = 0; i < words.length; i++) {
currentLineWords.push(words[i]);
currentSpaces = currentLineWords.length - 1;
currentLineLength += words[i].length;