Giter VIP home page Giter VIP logo

backend-interview-challenge's Introduction

Backend programming challenge

Tl;dr - just perform the operation against the database, and save the result to a text file.

General rules:

  • You can use any programming language you’d like.
  • You can use the Internet as much as you’d like (without cheating.)
  • We don’t care much about performance.
  • Tests are optional (but correction will probably be taken into consideration.)

You need two files (other files can be ignored.):

It’s the database, stored as a file.

There’s two columns, separated by a pipe “|” symbol.

  • The first column is the id of the row.
  • The second column are points on a 2D coordinate plane
    • Points are separated by a semi-colon “;”
    • The x position is before the comma, y position is after it.
    • There’s at most 7 points for a given shape, and minimum 3.
    • You can safely assume that each number in the point is less than 32 bits in size.
    • The points themselves having no real meaning or sort order.

It’s the operations to be performed against the database.

  • The amount of columns are variable depending on the operation.
    • The first column is the operation to be performed
      • Operation: delete-shape (delete the shape)
      • Operation: create-shape
        • Create a new shape, it’s points are listed in the last column.
      • Operation: add-point
        • Append the point onto the list of points for that shape.
      • Operation: delete-point
        • The last column is the index of the point to delete (zero indexed.) So, if the last column is a 3, find the shape in the database, and delete the fourth point.
    • The second column is the id
      • For add and delete, this is the shape to modify.
      • For create-shape, this should be the id of the new shape.
  • To make things easier, you can safely assume that there’s no more than one operation per shape (meaning: ids are distinct within operations.data)

Your task

  1. Read in the database.
  2. Print (to the console) the counts of each shape (triangles, squares, pentagons, etc.) (nothing pretty needed, but display their counts.)
    • Where a triangle has 3 points, square has 4 points, pentagon has 5 points, etc.
  3. Perform the operations against the data.
  4. Repeat step 2 – meaning reprint the count of each shape.
  5. Print the updated database to a file like “updated.db”.
  6. Send us your code and the updated db.

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.