Git Product home page Git Product logo

celsoaramos / bananas Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 55 KB

Looking for Bananas in the Monkeys island Given a Jungle in the middle of an island of n*m dimensions. Each field in this jungle contains a positive integer which is the amount of bananas that exist in that field. Initially the monkey is at first column but can be at any row. The monkey can move only (right->,right up /,right down\) from a given cell. Find out the maximum amount of bananas they can collect.

Java 100.00%

bananas's Introduction

Bananas


Descrição

Looking for Bananas in the Monkeys island Given a Jungle in the middle of an island of n*m dimensions.
Each field in this jungle contains a positive integer which is the amount of bananas that exist in that field.
Initially the monkey is at first column but can be at any row.
The monkey can move only (right->,right up /,right down\) from a given cell.
Find out the maximum amount of bananas they can collect.




Solução pensada

A intenção do método principal é percorrer o array bidimensional de trás para frente, ou seja,
passando pelas linhas da última coluna até percorrer as linhas da primeira coluna.

Em cada iteração forma-se um novo array com os dados obtidos na iteração.
Logo, na primeira coluna surgirá o array de maior valor.

font de estudo:
https://www.youtube.com/watch?v=6rqcqUyyXvM



Dados de entrada

Por ser uma aplicação simples, não foi criado classe de teste.
Na classe main adicionei 3 mocks e coloquei os resultados esperados em forma de comentário.

É possível alterar os valores de entrada.



Testar

Seguir os passos:
1. Realizar o clone do projeto
2. Abri na IDE favorita (foi utilizado Spring Tool Suite)
3. Navegar até a classe BananasApplication
4. Botão direito em cima da classe -> Run as -> Java application

bananas's People

Contributors

celsoaramos 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.