From 2c1545afae904b90a1231e289784c73b117f7ab6 Mon Sep 17 00:00:00 2001 From: avivasyuta Date: Fri, 7 Feb 2025 20:27:35 +0100 Subject: [PATCH 1/2] number of provinces solution --- content/blog/number_of_provinces/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/blog/number_of_provinces/index.md b/content/blog/number_of_provinces/index.md index 8a620fe..116f296 100644 --- a/content/blog/number_of_provinces/index.md +++ b/content/blog/number_of_provinces/index.md @@ -79,7 +79,7 @@ isConnected = [[1,0,0],[0,1,0],[0,0,1]] Алгоритм решения: -- Создать инстанс структуру данных `DisjointSet`. +- Создать инстанс структуры данных `DisjointSet`. - Определить переменную `numberOfProvinces` равную `n` в начале состояния. Далее мы будем уменьшать ее значение при объединении городов в провинцию. - Так как главная диагональ матрицы `isConnected` отображает соединение каждого города с самим собой, то мы можем ее не From c24c98740263a96aa15301e58a83017109d5b012 Mon Sep 17 00:00:00 2001 From: avivasyuta Date: Fri, 7 Feb 2025 20:29:17 +0100 Subject: [PATCH 2/2] number of provinces solution --- content/blog/number_of_provinces/index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/blog/number_of_provinces/index.md b/content/blog/number_of_provinces/index.md index 116f296..d58f059 100644 --- a/content/blog/number_of_provinces/index.md +++ b/content/blog/number_of_provinces/index.md @@ -92,6 +92,10 @@ isConnected = [[1,0,0],[0,1,0],[0,0,1]] В итоге после перебора элементов матрицы переменная `numberOfProvinces` будет показывать количество получившихся провинций. +### Реализация + +{% renderFile "_includes/components/solution.njk", taskName = "number_of_provinces" %} + ### Оценка сложности **По времени**