Skip to content

Conversation

VeronicaM
Copy link
Owner

@VeronicaM VeronicaM commented May 9, 2020

All PRs

  • I have self-reviewed my code
  • I have written tests which cover new and changed functionality
  • All tests pass
  • I have commented on difficult to understand code

Where Relevant

  • I have compared and validated my UI changes against the designs
  • I've updated relevant documentation e.g. README

Description

What is this PR about ?

Find the minimum energy a drone will need to start with to be able to complete a flight of a given array of 3D points knowing that when it ascends it consumes 1 Kwh and when it descends it ads 1 kwh.

This was the question I have been given to solve by my interviewer on my first interview on Pramp

What was implemented ?

  • Loop over the array of 3D points and at each step compute the energy used or saved while flying between 2 given points.
  • Keep track of the largest energy deficit as you compute energy consumption
  • Returned the largest energy deficit as a positive integer.

What did you learn ?

  • How to explain myself the problem and its solution in a graphical way on paper.

image

  • How to reason about problems that ask you to ensure an optimal state of a system

Runtime complexity: O(n), where n is the number of 3D points in the array
Space complexity: O(1)

What links/documents relate to this PR ?

Testing

Steps required to test

  • cd interviews/pramp/drone-flight-planner
  • run node drone-flight-planner.js

All tests should pass
Test cases can be found in interviews/pramp/drone-flight-planner/testData

@VeronicaM VeronicaM merged commit 3ef1a11 into master May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant