Skip to content

Instantly share code, notes, and snippets.

@slmyers
Last active April 15, 2017 23:55
Show Gist options
  • Save slmyers/4c9d37a391a78823838c7509ea7e29cc to your computer and use it in GitHub Desktop.
Save slmyers/4c9d37a391a78823838c7509ea7e29cc to your computer and use it in GitHub Desktop.
Novosbed Inc application questions

In the context of Computer Science recursion refers to a function that calls itself in order to arrive at a return value. In order to avoid infinite recursion (infinite loop) a base case is established which does not have a recursive call. This
solution is typically employed in Divide and Conquer algorithms or where recursion is more elegant than a loop. A common example is calculating a number's factorial. Here is an example written in es6.

const factorial = number => number === 1 ? 1 : number * factorial(number - 1);

Relative positioning is a css property that affects a DOM element's layout relative to it's static layout. By default an element has static positioning which basically means that an element is separated vertically from the previous element by relevant vertical margins and a new line with 100% width. So, relative position alter's the elements position relative to it's static position.

Example:

<style>
  .previous {
    height: 20px;
    background-color: yellow;
  }

  .current {
    position: relative;
    height: 20px;
    top: -20px;
    background-color: blue;
  }
</style>

<div class="previous">previous</div>
<div class="current">current</div>

With this CSS, the .current div will position itself on top of the .previous div, so the background color for that part of the DOM will be blue and the text will say current, ie only the current element will display on the screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment