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 tables = [ | |
| ...document.getElementsByClassName("genshin_table skill_table"), | |
| ]; | |
| const imageUrls = tables.map((table) => { | |
| const icon = table.querySelector("img"); | |
| return icon.src; | |
| }); | |
| const [ |
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
| vector<int> mergeSorted(vector<int>& valuesA, vector<int>& valuesB) { | |
| int idxA = 0, idxB = 0; | |
| vector<int> result; | |
| while (idxA < valuesA.size() && idxB < valuesB.size()) { | |
| if (valuesA[idxA] < valuesB[idxB]) { | |
| result.push_back(std::move(valuesA[idxA++])); | |
| } else { | |
| result.push_back(std::move(valuesB[idxB++])); | |
| } |
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
| int outOfOrder(vector<int>& values) { | |
| vector<int> expected = values; | |
| sort(expected.begin(), expected.end()); | |
| int mismatches = 0; | |
| for (int idx = 0; idx < values.size(); idx++) { | |
| mismatches += expected[idx] != values[idx]; | |
| } | |
| return mismatches; |
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
| bool isAnagram(string& wordA, string& wordB) { | |
| vector<int> frequencies(26, 0); | |
| for (char letter : wordA) frequencies[letter - 'a']++; | |
| for (char letter : wordB) frequencies[letter - 'a']--; | |
| for (int difference : frequencies) { | |
| if (difference != 0) return false; | |
| } | |
| return true; |
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 isPalindrome(word: string): boolean { | |
| let left = 0; | |
| let right = word.length - 1; | |
| while (left < right) { | |
| if (word[left] != word[right]) return false; | |
| left++, right--; | |
| } | |
| return true; | |
| } |
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
| bool isPalindrome(string& word) { | |
| int left = 0, right = word.size() - 1; | |
| while (left < right) { | |
| if (word[left] != word[right]) return false; | |
| left++, right--; | |
| } | |
| return true; | |
| } |
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
| bool isPalindrome(string& word) { | |
| string copy = word; | |
| reverse(copy.begin(), copy.end()); | |
| return word == copy; | |
| } |
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 isPalindrome(word: string): boolean { | |
| const reversed = Array.from(word).reverse().join(""); | |
| return word === reversed; | |
| } |
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
| #include <iostream> | |
| #include <fstream> | |
| #include <unistd.h> | |
| void process_mem_usage(double& vm_usage, double& resident_set) | |
| { | |
| vm_usage = 0.0; | |
| resident_set = 0.0; | |
| // the two fields we want |
NewerOlder