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 inRankingOrder(arr) { | |
return arr.sort((obj1, obj2) => { | |
const ranking1 = obj1.ranking, | |
ranking2 = obj2.ranking; | |
return ranking1 < ranking2 ? -1 : (ranking1 > ranking2 ? 1 : 0); | |
}); | |
} | |
function averageRanking(arr) { | |
const sum = arr.map(obj => obj.ranking). |
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
using System.Collections; | |
using System.IO; | |
class FileListings { | |
public void ListFiles() { | |
var directory = new System.IO.DriveInfo(@"C:\").RootDirectory; | |
var folders = new Stack<DirectoryInfo>(); | |
var files = new Stack<FileInfo>(); |
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
object StringFinder { | |
/** | |
* Finds the first occurrence of a substring (`query`) within a `text`. | |
* @param text - the text to search in. | |
* @param query - the substring to find in `text`. | |
* @param pos - position in text to start searching from. | |
*/ | |
def find(text: String, query: String)(pos: Int): Unit = { | |
/* | |
* make sure `pos` hasn't gone out |
NewerOlder