Git Product home page Git Product logo

copia-coding-challenge-algorithm's Introduction

Copia-Coding-Challenge(Algorithm)

How to run the code

Use node command to run the code in the terminal. Before that please make sure to have node.js installed(v14.13.0 or later) on the development machine.

//For the first task
node task1 
// For the second task
node task2

Extra

There are some comments in the code to show approaches for the tasks.

Tasks

Sync Question

For this question we want you to synchronize two lists. Each list contains only integers. The goal of the problem is to return the list of integers which are not contained in both lists.

// some examples in python pseudo-code
>> sync([1, 2, 3], [1, 3, 4])
>> [2, 4]
>> sync([1, 9], [1])
>> [9]
>> sync([1, 2, 3], [1, 2, 3])
>> []

Consider the trade-offs between time complexity and spatial complexity in different solutions, explain why you made the decision you did, as well as any other solutions you might have chosen.

Deep Equality

For this question we want to show the deep equality of two hashmaps. To simpify the problem, you can assume that each hash map always uses a string as a key and a map, number, or string as a value. For the purpose of this problem, you can assume that any equals operator for two hash maps is not enabled.

// some examples in python pseudo-code
>> equals({"key1" : "value", 
           "key2" : {"key3": 1}},
          {"key1" : "value", 
           "key2" : {"key3": 1}})
>> true
>> equals({"key1" : "value1", 
           "key2" : {"key3": 1},
           "key4" : "value2"},
          {"key1" : "value", 
           "key2" : {"key3": 1}})
>> false

Once this is complete, and if time permits, extend the problem to handle arrays.

// some examples in python pseudo-code
>> equals({"key1" : "value", 
           "key2" : [1, 2, 3]},
          {"key1" : "value", 
           "key2" : [1, 2, 3]})
>> true
>> equals({"key1" : "value1", 
           "key2" : [{"key3": 1}]},
          {"key1" : "value", 
           "key2" : [{"key3": 1}]})
>> true
>> equals({"key1" : "value1", 
           "key2" : [{"key3": 1}]},
          {"key1" : "value", 
           "key2" : [{"key3": 1}, 2]})
>> false
>> equals({"key1" : "value1", 
           "key2" : [{"key3": [1, 2]}]},
          {"key1" : "value", 
           "key2" : [{"key3": [1, 2]}]})
>> true

copia-coding-challenge-algorithm's People

Watchers

Mario Ruis 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.