Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW ALGORITHM] : Frog Jump #1827

Closed
2 tasks done
ananydev opened this issue Nov 9, 2024 · 1 comment
Closed
2 tasks done

[NEW ALGORITHM] : Frog Jump #1827

ananydev opened this issue Nov 9, 2024 · 1 comment

Comments

@ananydev
Copy link
Contributor

ananydev commented Nov 9, 2024

Issue will be closed if:

  1. You mention more than one algorithm. You can create a separate issue for each algorithm once the current one is completed.
  2. You propose an algorithm that is already present or has been mentioned in a previous issue.
  3. You create a new issue without completing your previous issue.

Note: These actions will be taken seriously. Failure to follow the guidelines may result in the immediate closure of your issue.


Name: Frog Jump

[NEW ALGORITHM]

About:

Propose a new algorithm to be added to the repository
Geek wants to climb from the 0th stair to the (n-1)th stair. At a time the Geek can climb either one or two steps. A height[N] array is also given. Whenever the geek jumps from stair i to stair j, the energy consumed in the jump is abs(height[i]- height[j]), where abs() means the absolute difference. return the minimum energy that can be used by the Geek to jump from stair 0 to stair N-1.

Example:

Input: n = 4, height = {10 20 30 10}
Output: 20
Explanation:
Geek jump from 1st to 2nd stair(|20-10| = 10 energy lost). Then a jump from the 2nd to the last stair(|10-20| = 10 energy lost). So, total energy lost is 20 which is the minimum.
Expected Time Complexity: O(n)
Expected Space Complexity: O(n)


Labels:

new algorithm, gssoc-ext, hacktoberfest, level1


Assignees:

  • Contributor in GSSoC-ext
  • Want to work on it
@ananydev
Copy link
Contributor Author

ananydev commented Nov 9, 2024

@pankaj-bind kindly assign me asap as it's last day to contribute

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

No branches or pull requests

2 participants