build(build system or external dependencies changes)
ci(CI configurations and scripts changes)
docs(documentation)
feat(feature)
fix(bug fix)
perf(improves performance)
refactor(restructuring existing code, but not bug or feature)
revert(reverts a previous commit)
style(formatting, missing semi colons, etc.)
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
| Windows Registry Editor Version 5.00 | |
| [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
| "Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3a,00,00,00,00,00 | |
| ; Data = 00000000 00000000 0200000000 01003A00 00000000 | |
| ; 0x00000000 Header: Version. Set to all zeroes. | |
| ; 0x00000000 Header: Flags. Set to all zeroes. | |
| ; 0x00000002 Two entries in the map (including null entry). |
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
| local M = {} | |
| function M:peek(job) | |
| local start, cache = os.clock(), ya.file_cache(job) | |
| if not cache then return end | |
| local ok, err = self:preload(job) | |
| if not ok or err then | |
| return ya.preview_widget(job, err) | |
| end |
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
| #!/usr/bin/env bash | |
| if [[ $# -gt 0 ]]; then | |
| input="$1" | |
| else | |
| read -r input _ <<< "$(cat)" | |
| fi | |
| if [[ -z "$input" ]]; then | |
| exit 0 |
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 longestWord = (str: string): void => { | |
| if (str?.length === 0) return; | |
| const words: string[] = str.split(" "); | |
| const longest: string = words.reduce( | |
| (a, b) => (b.length > a.length ? b : a), | |
| "", | |
| ); | |
| console.log(longest.length, longest); | |
| }; |
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 whatFlavors(cost, targetAmount) { | |
| const priceToIndexMap = new Map(); | |
| for (const [currentIndex, currentPrice] of cost.entries()) { | |
| const neededPrice = targetAmount - currentPrice; | |
| const displayIndex = currentIndex + 1; | |
| if (priceToIndexMap.has(neededPrice)) { | |
| const firstFlavorIndex = priceToIndexMap.get(neededPrice); | |
| console.log(`${firstFlavorIndex} ${displayIndex}`); | |
| return; | |
| } |
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 checkMagazine(magazine, note) { | |
| // Create a frequency map of words available in the magazine | |
| const availableWords = new Map(); | |
| for (const word of magazine) { | |
| const currentCount = availableWords.get(word) ?? 0; | |
| availableWords.set(word, currentCount + 1); | |
| } | |
| // Check if we can form the note using available words | |
| for (const requiredWord of note) { | |
| const remainingCount = availableWords.get(requiredWord) ?? 0; |
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 quickSort(arr) { | |
| if (arr.length === 0) return []; | |
| const pivot = arr[0]; | |
| const left = arr.filter((num, i) => i !== 0 && num < pivot); | |
| const equal = arr.filter(num => num === pivot); | |
| const right = arr.filter((num, i) => i !== 0 && num > pivot); | |
| return [...left, ...equal, ...right]; | |
| } |
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 bigSorting(unsorted) { | |
| return unsorted.sort((a,b) => { | |
| const bigA = BigInt(a); | |
| const bigB = BigInt(b); | |
| if (bigA < bigB) return -1; | |
| if (bigA > bigB) return 1; | |
| return 0; | |
| }); | |
| } |
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 checkLevelOrderBST(levelOrder) { | |
| if (levelOrder.length === 0) return true; | |
| let i = 0; | |
| const n = levelOrder.length; | |
| // Stack to store nodes with their min and max constraints | |
| const stack = []; | |
| stack.push({ | |
| data: levelOrder[0], | |
| min: -Infinity, | |
| max: Infinity, |
NewerOlder