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
#include <Constants.au3> | |
#include <GUIConstantsEx.au3> | |
#include <WindowsConstants.au3> | |
$count = 125 | |
$label = 0 | |
$button = 0 | |
Func _WriteErrorLog($ErrorMessage) | |
FileWriteLine(@ScriptDir & "\" & @ScriptName & ".log", @HOUR & ":" & @MIN & ":" & @SEC & ": " & $ErrorMessage) |
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
#include <Constants.au3> | |
#include <GUIConstantsEx.au3> | |
#include <WindowsConstants.au3> | |
$count = 125 | |
$label = 0 | |
$button = 0 | |
Func _WriteErrorLog($ErrorMessage) | |
FileWriteLine(@ScriptDir & "\" & @ScriptName & ".log", @HOUR & ":" & @MIN & ":" & @SEC & ": " & $ErrorMessage) |
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
using System.Diagnostics; | |
using Microsoft.AspNetCore.Mvc; | |
using ReverseLinkedListApp.Models; | |
namespace ReverseLinkedListApp.Controllers; | |
public class HomeController : Controller | |
{ | |
private readonly ILogger<HomeController> _logger; |
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
// in your extension's background script | |
chrome.browserAction.onClicked.addListener(function(tab) { | |
// inject the content script to the current tab | |
chrome.tabs.executeScript(tab.id, {file: 'content.js'}); | |
}); | |
// listen for messages from the content script | |
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { | |
if (message.action == 'getImages') { | |
// message.data is an array of image urls |
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
/** | |
* const PriorityQueue = require('priority-queue-js'); | |
*/ | |
class Solution { | |
/** | |
* @param {number} n | |
* @param {number[][]} edges | |
* @param {number} src | |
* @returns {Object} |
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 typing import List | |
from collections import namedtuple | |
Pair = namedtuple('Pair', ['key', 'value']) | |
# Definition for a pair. | |
# class Pair: | |
# def __init__(self, key: int, value: str): | |
# self.key = key | |
# self.value = value |
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
class Node { | |
constructor(value, next) { | |
this.value = value; | |
this.next = next; | |
} | |
} | |
class LinkedList { | |
constructor() { | |
this.head = null; |
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
class DynamicArray { | |
/** | |
* @constructor | |
* @param {number} capacity | |
*/ | |
constructor(capacity) { | |
this.data = new Array(capacity); | |
this.num_elements = 0; | |
} |
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
// Solved by calculating difference between each point diagonally and straight remainder. | |
const minTimeToVisitAllPoints = (points: number[][]): number => { | |
let moves = 0; | |
for (let i=1; i<points.length; i++) { | |
const dist_x = Math.abs(points[i-1][0] - points[i][0]); | |
const dist_y = Math.abs(points[i-1][1] - points[i][1]); | |
const dist_diag = Math.min(dist_x, dist_y); | |
const dist_straight = Math.abs(dist_y - dist_x); |
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
// Add two binary strings directly by using a carry bit. | |
const addBinary = (a:string, b:string): string => { | |
let result: string = ''; | |
let i=0; | |
let carry = 0; | |
while (i < a.length || i < b.length) { | |
let a_bit = '0'; | |
let b_bit = '0'; | |
let bit = 0; |
NewerOlder