Giter Site home page Giter Site logo

jetbrains-scala-tasks's Introduction

Jetbrains Tasks

Warmup

  1. Big-O complexity of the given recursive function is O(2^n).

  2. We can definitely do better by iterating n times and in each iteration multiply the input number by two (as illustrated in the function faster_pow_two) The complexity of this algorithm will be O(n). The fastest and best solution can be achieved using the optimized built-in math.pow function as seen in fastest_pow_two function below. The complexity of this function is going to be O(1).

You can see the code in file Warmup.scala to look at the implementation of the given recursive function and the more efficient ones for the same problem.

JSON serialization

I used the well-documented Play Framework for JSON formatting. This frameworks has many built-in functions which come in handy and makes it very easy for JSON formatting. For testing, I used ScalaTest which is also very well-documented and provides simple and clear syntax.

My program can:

  • Convert a BooleanExpression to a JSON format.
  • Convert a JSON format to a BooleanExpression.

You can run the program Main.scala to see the conversion in action.

jetbrains-scala-tasks's People

Contributors

basilnajjar avatar

Watchers

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