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 allReports = `` // For simplicity, I chose to keep the input here instead of accepting as CLI input | |
| const splitReports = allReports.split('\n') | |
| .filter(report => report.length) | |
| .map(report => report.split(' ').map(val => parseInt(val))) | |
| function isReportSafe(report) { | |
| const isIncreasing = report[0] < report[1]; | |
| return report.every((val, i) => { | |
| if (i === 0) return true; // skip initial position |
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
| #Giant dictonary to hold key name and VK value | |
| VK_CODE = {'backspace':0x08, | |
| 'tab':0x09, | |
| 'clear':0x0C, | |
| 'enter':0x0D, | |
| 'shift':0x10, | |
| 'ctrl':0x11, | |
| 'alt':0x12, | |
| 'pause':0x13, | |
| 'caps_lock':0x14, |