Coder Social home page Coder Social logo

findcelebrity's Introduction

Suppositions

  • Only can there one celebrity
  • Not necessary everyone know each others
  • There may not be any celebrity

Solution Explanation

Used Stack method to solve problem.

Add all of people to stack, while stack contains two or more persons take two person of them from top and asked to first person if knows second person, if knows means second person can be a celebrity else firs person can be.

After that, when stack has only one person who is a possible celebrity, run validation asking all people if they know the possible celebrity, if they know then return celebrity otherwise return message "Not found celebrity"

Implementation Explanation

Created a Rest service with two endpoints

First endpoint

Sent file with data, if exists celebrity return it, else return message "Not celebrity found"

A csv file must be sent as Multipart request with people's data in the following format

When person has unique relationship

{idPerson}:{idPersonRelation};

E.G. 1:1;

When person has many relationships

{idPerson}:{idPersonRelation1},{idRelationN};

E.G. 4:2,5,6,7;

Method: POST  
/api/find-celebrity/process
[email protected]

Second endpoint

Used to query result from database using process id

Method: GET
/api/find-celebrity/process/{idProcess}

How build

mvn clean install

How run

mvn spring-boot:run

findcelebrity's People

Contributors

jeissonflorez avatar jflorez29 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.