From 7278b038c680d960d2c7d4858cb836144b90ea1c Mon Sep 17 00:00:00 2001 From: Jijie LIU Date: Wed, 19 Oct 2022 22:23:50 +0200 Subject: [PATCH] rename the object class name of Scala Solution 2 --- problems/0541.反转字符串II.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0541.反转字符串II.md b/problems/0541.反转字符串II.md index f38ac042..238e6349 100644 --- a/problems/0541.反转字符串II.md +++ b/problems/0541.反转字符串II.md @@ -401,7 +401,7 @@ object Solution { ``` 版本二: 首先利用grouped每隔k个进行分割,再使用zipWithIndex添加每个数组的索引,紧接着利用map做变换,如果索引%2==0则说明需要翻转,否则原封不动,最后再转换为String ```scala -object SolutionFunc { +object Solution { def reverseStr(s: String, k: Int): String = { // s = "abcdefg", k = 2 s.grouped(k) // Iterator ["ab", "cd", "ef", "g"]