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 CAT_FACT_API_BASE_URL = "https://catfact.ninja"; | |
| type CatFactResponse = { | |
| fact: string; | |
| length: number; | |
| }; | |
| type CleanCatFact = { | |
| text: string; | |
| length: 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
| function findUniquePairs(arr: number[], target: number): number[][] { | |
| if (arr.length < 2) return []; | |
| const result: number[][] = []; | |
| const nums = [...arr].sort((a, b) => a - b); | |
| let left = 0; | |
| let right = nums.length - 1; | |
| while (left < right) { |