Code Monkey home page Code Monkey logo

test-cluster's Introduction

test-cluster

Тестовое задание.

Есть поле 5x5. Каждая ячейка поля наполняется случайными числами от 0 до 3. Например:

0 1 2 3 0
1 2 3 0 1
2 3 0 1 2
3 0 1 2 3
0 1 3 3 3

Соседними считаются ячейки граничащие друг с другом своими сторонами, диагональные элементы не считаются соседними. Соседние ячейки для числа 2 - координаты (1,1) из примера выше:

_ 1 _ _ _
1 2 3 _ _
_ 3 _ _ _
_ _ _ _ _
_ _ _ _ _

Если на поле существуют такие соседние ячейки, числа в которых одинаковы и таких ячеек 4+, то считается, что они образовали кластер. Пример кластера:

_ _ _ _ _
_ _ _ _ _
_ _ _ _ _
_ _ _ _ 3
_ _ 3 3 3

Задание:

  1. Написать генератор поля 5х5
  2. Написать алгоритм оптимального поиска кластеров вида findClusters(field: Field): Array<Cluster>. На выходе ожидается массив кластеров
  3. Оценить сложность полученного алгоритма
  4. Если задача кажется слишком простой, то размер поля и размер кластера сделать вариативными

test-cluster's People

Contributors

tatianmal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.