Skip to content

Instantly share code, notes, and snippets.

View danidh05's full-sized avatar

Daniel Dhaini danidh05

View GitHub Profile
import fetch from "node-fetch";
import dotenv from "dotenv";
// Load environment variables from .env file
dotenv.config();
// Type definitions for better type safety
interface WeatherResponse {
city: string;
temperature: number;
/**
* Find all unique pairs of numbers in an array whose sum equals a target value.
*
* @param arr - Array of integers
* @param target - Target sum
* @returns Array of unique pairs
*/
function findPairs(arr: number[], target: number): number[][] {
if (!arr || arr.length < 2) return [];