题目描述 请你判断一个 9 x 9 的数独是否有效。只需要 根据以下规则 ,验证已经填入的数字是否有效即可。
数字 1-9 在每一行只能出现一次。
数字 1-9 在每一列只能出现一次。
数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。(请参考示例图)
注意:
一个有效的数独(部分已被填充)不一定是可解的。
只需要根据以上规则,验证已经填入的数字是否有效即可。
空白格用 ‘.’ 表示。
示例 1:
输入:board = [[“5”,”3”,”.”,”.”,”7”,”.”,”.”,”.”,”.”] ,[“6”,”.”,”.”,”1”,”9”,”5”,”.”,”.”,”.”] ,[“.”,”9”,”8”,”.”,”.”,”.”,”.”,”6”,”.”] ,[“8”,”.”,”.”,”.”,”6”,”.”,”.”,”.”,”3”] ,[“4”,”.”,”.”,”8”,”.”,”3”,”.”,”.”,”1”] ,[“7”,”.”,”.”,”.”,”2”,”.”,”.”,”.”,”6”] ,[“.”,”6”,”.”,”.”,”.”,”.”,”2”,”8”,”.”] ,[“.”,”.”,”.”,”4”,”1”,”9”,”.”,”.”,”5”] ,[“.”,”.”,”.”,”.”,”8”,”.”,”.”,”7”,”9”]] 输出:true
示例 2:
输入:board = [[“8”,”3”,”.”,”.”,”7”,”.”,”.”,”.”,”.”] ,[“6”,”.”,”.”,”1”,”9”,”5”,”.”,”.”,”.”] ,[“.”,”9”,”8”,”.”,”.”,”.”,”.”,”6”,”.”] ,[“8”,”.”,”.”,”.”,”6”,”.”,”.”,”.”,”3”] ,[“4”,”.”,”.”,”8”,”.”,”3”,”.”,”.”,”1”] ,[“7”,”.”,”.”,”.”,”2”,”.”,”.”,”.”,”6”] ,[“.”,”6”,”.”,”.”,”.”,”.”,”2”,”8”,”.”] ,[“.”,”.”,”.”,”4”,”1”,”9”,”.”,”.”,”5”] ,[“.”,”.”,”.”,”.”,”8”,”.”,”.”,”7”,”9”]] 输出:false 解释:除了第一行的第一个数字从 5 改为 8 以外,空格内其他数字均与 示例1 相同。 但由于位于左上角的 3x3 宫内有两个 8 存在, 因此这个数独是无效的。
提示:
board.length == 9
board[i].length == 9
board[i][j] 是一位数字(1-9)或者 ‘.’
解决方法 C++ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 class Solution {public : bool isValidSudoku (vector<vector<char >>& board) { for (int i = 0 ; i < 9 ; ++i) { unordered_set<char > rowSet; for (int j = 0 ; j < 9 ; ++j) { if (board[i][j] != '.' ) { if (rowSet.find (board[i][j]) != rowSet.end ()) { return false ; } rowSet.insert (board[i][j]); } } } for (int j = 0 ; j < 9 ; ++j) { unordered_set<char > colSet; for (int i = 0 ; i < 9 ; ++i) { if (board[i][j] != '.' ) { if (colSet.find (board[i][j]) != colSet.end ()) { return false ; } colSet.insert (board[i][j]); } } } for (int blockRow = 0 ; blockRow < 3 ; ++blockRow) { for (int blockCol = 0 ; blockCol < 3 ; ++blockCol) { unordered_set<char > blockSet; for (int i = 0 ; i < 3 ; ++i) { for (int j = 0 ; j < 3 ; ++j) { char currentNum = board[blockRow * 3 + i][blockCol * 3 + j]; if (currentNum != '.' ) { if (blockSet.find (currentNum) != blockSet.end ()) { return false ; } blockSet.insert (currentNum); } } } } } return true ; } };
结果 执行用时 : 17 ms, 击败 54.62% 使用 C++ 的用户
内存消耗 : 23.61 MB, 击败 5.03% 使用 C++ 的用户
Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 public class Solution { public boolean isValidSudoku (char [][] board) { for (int i = 0 ; i < 9 ; ++i) { HashSet<Character> rowSet = new HashSet <>(); for (int j = 0 ; j < 9 ; ++j) { if (board[i][j] != '.' ) { if (rowSet.contains(board[i][j])) { return false ; } rowSet.add(board[i][j]); } } } for (int j = 0 ; j < 9 ; ++j) { HashSet<Character> colSet = new HashSet <>(); for (int i = 0 ; i < 9 ; ++i) { if (board[i][j] != '.' ) { if (colSet.contains(board[i][j])) { return false ; } colSet.add(board[i][j]); } } } for (int blockRow = 0 ; blockRow < 3 ; ++blockRow) { for (int blockCol = 0 ; blockCol < 3 ; ++blockCol) { HashSet<Character> blockSet = new HashSet <>(); for (int i = 0 ; i < 3 ; ++i) { for (int j = 0 ; j < 3 ; ++j) { char currentNum = board[blockRow * 3 + i][blockCol * 3 + j]; if (currentNum != '.' ) { if (blockSet.contains(currentNum)) { return false ; } blockSet.add(currentNum); } } } } } return true ; } }
结果 执行用时 : 2 ms, 击败 41.51% 使用 Java 的用户
内存消耗 : 43.24 MB, 击败 26.12% 使用 Java 的用户
Python 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 class Solution (object ): def isValidSudoku (self, board ): """ :type board: List[List[str]] :rtype: bool """ for i in range (9 ): row_set = set () for j in range (9 ): if board[i][j] != '.' : if board[i][j] in row_set: return False row_set.add(board[i][j]) for j in range (9 ): col_set = set () for i in range (9 ): if board[i][j] != '.' : if board[i][j] in col_set: return False col_set.add(board[i][j]) for block_row in range (3 ): for block_col in range (3 ): block_set = set () for i in range (3 ): for j in range (3 ): current_num = board[block_row * 3 + i][block_col * 3 + j] if current_num != '.' : if current_num in block_set: return False block_set.add(current_num) return True
结果 执行用时 : 30 ms, 击败 73.11% 使用 Python 的用户
内存消耗 : 11.45 MB, 击败 93.85% 使用 Python 的用户
Python3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 class Solution : def isValidSudoku (self, board: List [List [str ]] ) -> bool : for i in range (9 ): row_set = set () for j in range (9 ): if board[i][j] != '.' : if board[i][j] in row_set: return False row_set.add(board[i][j]) for j in range (9 ): col_set = set () for i in range (9 ): if board[i][j] != '.' : if board[i][j] in col_set: return False col_set.add(board[i][j]) for block_row in range (3 ): for block_col in range (3 ): block_set = set () for i in range (3 ): for j in range (3 ): current_num = board[block_row * 3 + i][block_col * 3 + j] if current_num != '.' : if current_num in block_set: return False block_set.add(current_num) return True
结果 执行用时 : 44 ms, 击败 85.12% 使用 Python3 的用户
内存消耗 : 16.44 MB, 击败 32.84% 使用 Python3 的用户
C 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 bool isValidSudoku (char ** board, int boardSize, int * boardColSize) { for (int i = 0 ; i < boardSize; ++i) { bool rowSet[10 ] = {false }; for (int j = 0 ; j < *boardColSize; ++j) { char currentNum = board[i][j]; if (currentNum != '.' ) { int digit = currentNum - '0' ; if (rowSet[digit]) { return false ; } rowSet[digit] = true ; } } } for (int j = 0 ; j < *boardColSize; ++j) { bool colSet[10 ] = {false }; for (int i = 0 ; i < boardSize; ++i) { char currentNum = board[i][j]; if (currentNum != '.' ) { int digit = currentNum - '0' ; if (colSet[digit]) { return false ; } colSet[digit] = true ; } } } for (int blockRow = 0 ; blockRow < 3 ; ++blockRow) { for (int blockCol = 0 ; blockCol < 3 ; ++blockCol) { bool blockSet[10 ] = {false }; for (int i = 0 ; i < 3 ; ++i) { for (int j = 0 ; j < 3 ; ++j) { char currentNum = board[blockRow * 3 + i][blockCol * 3 + j]; if (currentNum != '.' ) { int digit = currentNum - '0' ; if (blockSet[digit]) { return false ; } blockSet[digit] = true ; } } } } } return true ; }
结果 执行用时 : 6 ms, 击败 88.64% 使用 C 的用户
内存消耗 : 5.83 MB, 击败 77.45% 使用 C 的用户
C# 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 public class Solution { public bool IsValidSudoku (char [][] board ) { for (int i = 0 ; i < 9 ; ++i) { HashSet<char > rowSet = new HashSet<char >(); for (int j = 0 ; j < 9 ; ++j) { if (board[i][j] != '.' ) { if (rowSet.Contains(board[i][j])) { return false ; } rowSet.Add(board[i][j]); } } } for (int j = 0 ; j < 9 ; ++j) { HashSet<char > colSet = new HashSet<char >(); for (int i = 0 ; i < 9 ; ++i) { if (board[i][j] != '.' ) { if (colSet.Contains(board[i][j])) { return false ; } colSet.Add(board[i][j]); } } } for (int blockRow = 0 ; blockRow < 3 ; ++blockRow) { for (int blockCol = 0 ; blockCol < 3 ; ++blockCol) { HashSet<char > blockSet = new HashSet<char >(); for (int i = 0 ; i < 3 ; ++i) { for (int j = 0 ; j < 3 ; ++j) { char currentNum = board[blockRow * 3 + i][blockCol * 3 + j]; if (currentNum != '.' ) { if (blockSet.Contains(currentNum)) { return false ; } blockSet.Add(currentNum); } } } } } return true ; } }
结果 执行用时 : 91 ms, 击败 75.74% 使用 C# 的用户
内存消耗 : 47.38 MB, 击败 6.39% 使用 C# 的用户
JavaScript 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 var isValidSudoku = function (board ) { for (let i = 0 ; i < 9 ; ++i) { const rowSet = new Set (); for (let j = 0 ; j < 9 ; ++j) { if (board[i][j] !== '.' ) { if (rowSet.has (board[i][j])) { return false ; } rowSet.add (board[i][j]); } } } for (let j = 0 ; j < 9 ; ++j) { const colSet = new Set (); for (let i = 0 ; i < 9 ; ++i) { if (board[i][j] !== '.' ) { if (colSet.has (board[i][j])) { return false ; } colSet.add (board[i][j]); } } } for (let blockRow = 0 ; blockRow < 3 ; ++blockRow) { for (let blockCol = 0 ; blockCol < 3 ; ++blockCol) { const blockSet = new Set (); for (let i = 0 ; i < 3 ; ++i) { for (let j = 0 ; j < 3 ; ++j) { const currentNum = board[blockRow * 3 + i][blockCol * 3 + j]; if (currentNum !== '.' ) { if (blockSet.has (currentNum)) { return false ; } blockSet.add (currentNum); } } } } } return true ; };
结果 执行用时 : 69 ms, 击败 87.97% 使用 JavaScript 的用户
内存消耗 : 51.89 MB, 击败 29.43% 使用 JavaScript 的用户
TypeScript 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 function isValidSudoku (board : string [][] ): boolean { for (let i = 0 ; i < 9 ; ++i) { const rowSet = new Set <string >(); for (let j = 0 ; j < 9 ; ++j) { if (board[i][j] !== '.' ) { if (rowSet.has (board[i][j])) { return false ; } rowSet.add (board[i][j]); } } } for (let j = 0 ; j < 9 ; ++j) { const colSet = new Set <string >(); for (let i = 0 ; i < 9 ; ++i) { if (board[i][j] !== '.' ) { if (colSet.has (board[i][j])) { return false ; } colSet.add (board[i][j]); } } } for (let blockRow = 0 ; blockRow < 3 ; ++blockRow) { for (let blockCol = 0 ; blockCol < 3 ; ++blockCol) { const blockSet = new Set <string >(); for (let i = 0 ; i < 3 ; ++i) { for (let j = 0 ; j < 3 ; ++j) { const currentNum = board[blockRow * 3 + i][blockCol * 3 + j]; if (currentNum !== '.' ) { if (blockSet.has (currentNum)) { return false ; } blockSet.add (currentNum); } } } } } return true ; }
结果 执行用时 : 60 ms, 击败 99.15% 使用 TypeScript 的用户
内存消耗 : 52.70 MB, 击败 15.38% 使用 TypeScript 的用户
PHP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 class Solution { function isValidSudoku ($board ) { for ($i = 0 ; $i < 9 ; ++$i ) { $rowSet = []; for ($j = 0 ; $j < 9 ; ++$j ) { if ($board [$i ][$j ] !== '.' ) { if (isset ($rowSet [$board [$i ][$j ]])) { return false ; } $rowSet [$board [$i ][$j ]] = true ; } } } for ($j = 0 ; $j < 9 ; ++$j ) { $colSet = []; for ($i = 0 ; $i < 9 ; ++$i ) { if ($board [$i ][$j ] !== '.' ) { if (isset ($colSet [$board [$i ][$j ]])) { return false ; } $colSet [$board [$i ][$j ]] = true ; } } } for ($blockRow = 0 ; $blockRow < 3 ; ++$blockRow ) { for ($blockCol = 0 ; $blockCol < 3 ; ++$blockCol ) { $blockSet = []; for ($i = 0 ; $i < 3 ; ++$i ) { for ($j = 0 ; $j < 3 ; ++$j ) { $currentNum = $board [$blockRow * 3 + $i ][$blockCol * 3 + $j ]; if ($currentNum !== '.' ) { if (isset ($blockSet [$currentNum ])) { return false ; } $blockSet [$currentNum ] = true ; } } } } } return true ; } }
结果 执行用时 : 29 ms, 击败 72.00% 使用 PHP 的用户
内存消耗 : 19.94 MB, 击败 8.00% 使用 PHP 的用户
Swift 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 class Solution { func isValidSudoku (_ board : [[Character ]]) -> Bool { for i in 0 ..< 9 { var rowSet = Set <Character >() for j in 0 ..< 9 { if board[i][j] != "." { if rowSet.contains(board[i][j]) { return false } rowSet.insert(board[i][j]) } } } for j in 0 ..< 9 { var colSet = Set <Character >() for i in 0 ..< 9 { if board[i][j] != "." { if colSet.contains(board[i][j]) { return false } colSet.insert(board[i][j]) } } } for blockRow in 0 ..< 3 { for blockCol in 0 ..< 3 { var blockSet = Set <Character >() for i in 0 ..< 3 { for j in 0 ..< 3 { let currentNum = board[blockRow * 3 + i][blockCol * 3 + j] if currentNum != "." { if blockSet.contains(currentNum) { return false } blockSet.insert(currentNum) } } } } } return true } }
结果 执行用时 : 49 ms, 击败 100.00% 使用 Swift 的用户
内存消耗 : 16.05 MB, 击败 6.98% 使用 Swift 的用户
Kotlin 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 class Solution { fun isValidSudoku (board: Array <CharArray >) : Boolean { for (i in 0 until 9 ) { val rowSet = HashSet<Char >() for (j in 0 until 9 ) { if (board[i][j] != '.' ) { if (rowSet.contains(board[i][j])) { return false } rowSet.add(board[i][j]) } } } for (j in 0 until 9 ) { val colSet = HashSet<Char >() for (i in 0 until 9 ) { if (board[i][j] != '.' ) { if (colSet.contains(board[i][j])) { return false } colSet.add(board[i][j]) } } } for (blockRow in 0 until 3 ) { for (blockCol in 0 until 3 ) { val blockSet = HashSet<Char >() for (i in 0 until 3 ) { for (j in 0 until 3 ) { val currentNum = board[blockRow * 3 + i][blockCol * 3 + j] if (currentNum != '.' ) { if (blockSet.contains(currentNum)) { return false } blockSet.add(currentNum) } } } } } return true } }
结果 执行用时 : 192 ms, 击败 57.89% 使用 Kotlin 的用户
内存消耗 : 41.67 MB, 击败 36.84% 使用 Kotlin 的用户
Dart 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 class Solution { bool isValidSudoku(List <List <String >> board) { for (int i = 0 ; i < 9 ; ++i) { Set <String > rowSet = Set (); for (int j = 0 ; j < 9 ; ++j) { if (board[i][j] != "." ) { if (rowSet.contains(board[i][j])) { return false ; } rowSet.add(board[i][j]); } } } for (int j = 0 ; j < 9 ; ++j) { Set <String > colSet = Set (); for (int i = 0 ; i < 9 ; ++i) { if (board[i][j] != "." ) { if (colSet.contains(board[i][j])) { return false ; } colSet.add(board[i][j]); } } } for (int blockRow = 0 ; blockRow < 3 ; ++blockRow) { for (int blockCol = 0 ; blockCol < 3 ; ++blockCol) { Set <String > blockSet = Set (); for (int i = 0 ; i < 3 ; ++i) { for (int j = 0 ; j < 3 ; ++j) { String currentNum = board[blockRow * 3 + i][blockCol * 3 + j]; if (currentNum != "." ) { if (blockSet.contains(currentNum)) { return false ; } blockSet.add(currentNum); } } } } } return true ; } }
结果 执行用时 : 349 ms, 击败 -% 使用 Dart 的用户
内存消耗 : 147.78 MB, 击败 75.00% 使用 Dart 的用户
Go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 func isValidSudoku (board [][]byte ) bool { for i := 0 ; i < 9 ; i++ { rowSet := make (map [byte ]bool ) for j := 0 ; j < 9 ; j++ { if board[i][j] != '.' { if rowSet[board[i][j]] { return false } rowSet[board[i][j]] = true } } } for j := 0 ; j < 9 ; j++ { colSet := make (map [byte ]bool ) for i := 0 ; i < 9 ; i++ { if board[i][j] != '.' { if colSet[board[i][j]] { return false } colSet[board[i][j]] = true } } } for blockRow := 0 ; blockRow < 3 ; blockRow++ { for blockCol := 0 ; blockCol < 3 ; blockCol++ { blockSet := make (map [byte ]bool ) for i := 0 ; i < 3 ; i++ { for j := 0 ; j < 3 ; j++ { currentNum := board[blockRow*3 +i][blockCol*3 +j] if currentNum != '.' { if blockSet[currentNum] { return false } blockSet[currentNum] = true } } } } } return true }
结果 执行用时 : 3 ms, 击败 44.49% 使用 Go 的用户
内存消耗 : 2.49 MB, 击败 65.52% 使用 Go 的用户
Ruby 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 def is_valid_sudoku (board ) 9 .times do |i | row_set = Set .new 9 .times do |j | current_num = board[i][j] next if current_num == '.' return false if row_set.include ?(current_num) row_set.add(current_num) end end 9 .times do |j | col_set = Set .new 9 .times do |i | current_num = board[i][j] next if current_num == '.' return false if col_set.include ?(current_num) col_set.add(current_num) end end (0 ..2 ).each do |block_row | (0 ..2 ).each do |block_col | block_set = Set .new (0 ..2 ).each do |i | (0 ..2 ).each do |j | current_num = board[block_row * 3 + i][block_col * 3 + j] next if current_num == '.' return false if block_set.include ?(current_num) block_set.add(current_num) end end end end true end
结果 执行用时 : 71 ms, 击败 100.00% 使用 Ruby 的用户
内存消耗 : 206.64 MB, 击败 -% 使用 Ruby 的用户
Scala 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 object Solution { def isValidSudoku (board: Array [Array [Char ]]): Boolean = { for (i <- 0 until 9 ) { val rowSet = scala.collection.mutable.Set [Char ]() for (j <- 0 until 9 ) { val currentNum = board(i)(j) if (currentNum != '.') { if (rowSet.contains(currentNum)) { return false } rowSet.add(currentNum) } } } for (j <- 0 until 9 ) { val colSet = scala.collection.mutable.Set [Char ]() for (i <- 0 until 9 ) { val currentNum = board(i)(j) if (currentNum != '.') { if (colSet.contains(currentNum)) { return false } colSet.add(currentNum) } } } for (blockRow <- 0 until 3 ; blockCol <- 0 until 3 ) { val blockSet = scala.collection.mutable.Set [Char ]() for (i <- 0 until 3 ; j <- 0 until 3 ) { val currentNum = board(blockRow * 3 + i)(blockCol * 3 + j) if (currentNum != '.') { if (blockSet.contains(currentNum)) { return false } blockSet.add(currentNum) } } } true } }
结果 执行用时 : 553 ms, 击败 92.86% 使用 Scala 的用户
内存消耗 : 56.34 MB, 击败 35.71% 使用 Scala 的用户
Rust 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 use std::collections::HashSet;impl Solution { pub fn is_valid_sudoku (board: Vec <Vec <char >>) -> bool { for i in 0 ..9 { let mut row_set = HashSet::new (); for j in 0 ..9 { let current_num = board[i][j]; if current_num != '.' { if !row_set.insert (current_num) { return false ; } } } } for j in 0 ..9 { let mut col_set = HashSet::new (); for i in 0 ..9 { let current_num = board[i][j]; if current_num != '.' { if !col_set.insert (current_num) { return false ; } } } } for block_row in 0 ..3 { for block_col in 0 ..3 { let mut block_set = HashSet::new (); for i in 0 ..3 { for j in 0 ..3 { let current_num = board[block_row * 3 + i][block_col * 3 + j]; if current_num != '.' { if !block_set.insert (current_num) { return false ; } } } } } } true } }
结果 执行用时 : 5 ms, 击败 18.57% 使用 Rust 的用户
内存消耗 : 2.13 MB, 击败 44.29% 使用 Rust 的用户
Racket 暂时未解决
结果 执行用时 : ms, 击败 % 使用 Racket 的用户
内存消耗 : MB, 击败 % 使用 Racket 的用户
Erlang 暂时未解决
结果 执行用时 : ms, 击败 % 使用 Erlang 的用户
内存消耗 : MB, 击败 % 使用 Erlang 的用户
Elixir 暂时未解决
结果 执行用时 : ms, 击败 % 使用 Elixir 的用户
内存消耗 : MB, 击败 % 使用 Elixir 的用户