Code Monkey home page Code Monkey logo

javascript-recursion's Introduction

Sample Dataset:

CategoryId ParentCategoryId Name Keywords
100 -1 Business Money
200 -1 Tutoring Teaching
101 100 Accounting Taxes
102 100 Taxation
201 200 Computer
103 101 Corporate Tax
202 201 Operating System
109 101 Small business Tax

Write a working program which should do the following:

  • Given a category id return category name, parentCategoryId and key-word. Ensure that if key-word is not present for the category, then the data from its parent should be returned.

    • Input: 201
    • Output: ParentCategoryID=200, Name=Computer, Keywords=Teaching
    • Input: 202
    • Output: ParentCategoryID=201, Name=Operating System, Keywords=Teaching
  • Given category level as parameter (say N) return the names of the categories which are of N’th level in the hierarchy (categories with parentId -1 are at 1st level).

    • Input: 2
    • Output: 101, 102, 201
    • Input: 3
    • Output: 103, 109, 202

javascript-recursion's People

Watchers

James Cloos avatar Nicolas 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.