Created
March 13, 2022 01:58
-
-
Save webuilder240/e91cc7d20f08fbeaef53679e93deaa27 to your computer and use it in GitHub Desktop.
This file contains 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
// https://twitter.com/justin999_/status/1293738518989029379?s=21 | |
// | |
// 1万個のarrayを高速で作る方法を考えよ。 | |
// Swiftでいうなら、[[Int]]。 | |
// なお、それぞれのarrayの中身はランダム、長さは7である | |
// [ | |
// [1, 3, 9, 0, 1, 2, 4], | |
// [1, 9, 0, 7, 9 ,1, 2], | |
// ....(1万個) | |
// ] | |
result = [] | |
for (let i = 0; i < 10000; i++) { | |
let tmp = [] | |
for(j = 0; j < 7; j++) { | |
tmp.push(Math.floor(Math.random() * 9)) | |
} | |
result.push(tmp) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment