You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| leetcode | medium | 0560. subarray sum equals k | Java |[Solution.java](leetcode/java/medium/0560-subarray-sum-equals-k/Solution.java)|[notes.md](leetcode/java/medium/0560-subarray-sum-equals-k/notes.md)|
12
13
| leetcode | medium | 1493. longest subarray of 1s after deleting one element | Java |[Solution.java](leetcode/java/medium/1493-longest-subarray-of-1s-after-deleting-one-element/Solution.java)|[notes.md](leetcode/java/medium/1493-longest-subarray-of-1s-after-deleting-one-element/notes.md)|
Сделаем отдельный метод для сортировки строки, в котором преобразуем ее в массив и сортируем.
15
+
Далее сделаем хешмапу в которой ключом будет сортированная строка. А значением массив строк.
16
+
Так вот идем по строкам. Сначала ее сортируем и ищем. Есть ли такой ключ в хешмапе. Если нет, то создаем массив. Дальше просто кладем текущую строку по этому ключу.
17
+
В конце проходимся по хешмапе и перекладываем все массивы в переменную с ответом.
18
+
### Eng
19
+
By condition, it is necessary to group the anagrams of the strings.
20
+
Let's make a separate method for sorting a string, in which we convert it into an array and sort it.
21
+
Next, we will make a hashmap in which the key will be a sorted string. And the value is an array of strings.
22
+
So here we go along the lines. First, we sort it and search for it. Is there such a key in the hashmap? If not, then create an array. Then we just put the current line on this key.
23
+
At the end, we go through the hashmap and transfer all the arrays to the response variable.
0 commit comments