diff --git a/CPP/README.md b/CPP/README.md index 43ed59a..5271074 100644 --- a/CPP/README.md +++ b/CPP/README.md @@ -72,3 +72,5 @@ Format: -[Program name](name of the file) [N-Queens Proplem](N-QueensProblem.cpp) [Topological Sorting](Topological_sorting.cpp) + +[Climbing stairs with min moves](climb_stairs_with_min_moves.cpp) diff --git a/CPP/climb_stairs_with_min_moves.cpp b/CPP/climb_stairs_with_min_moves.cpp new file mode 100644 index 0000000..0382519 --- /dev/null +++ b/CPP/climb_stairs_with_min_moves.cpp @@ -0,0 +1,49 @@ +#include +using namespace std; + +int main() +{ + + int n; + cout<<"Enter the number of stairs:"<>n; // number of stairs + int jumps[n+1]={0}; + + cout<<"Enter the jumps at each stairs"<>jumps[i]; + queueq; + for(int i=0;i