Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions PARTICIPANTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@
- 📫 Reach me: **[email protected]**
- 🔭 Connect with me: **[SwastikMo](https://github.com/SwastikMo)**

---
### Connect with me:

<img align="right" src="https://avatars3.githubusercontent.com/<Github-ID>?size=100" width="100px;" alt=""/>

- 👨‍💻 My name is *<Hasnat Ahmed>r**
- 🌱 I’m a full stack developer.
- 📫 Reach me: **[email protected]**
- 🔭 Connect with me: **[hasnaat93](https://github.com/hasnaat93)**

---
### Connect with me:

Expand Down
63 changes: 13 additions & 50 deletions java/70-Climbing-Stairs.java
Original file line number Diff line number Diff line change
@@ -1,54 +1,17 @@
//optimal
class Solution {

public int climbStairs(int n) {
int a = 1;
int b = 1;
int c;

for (int i = 0; i < n - 1; i++) {
c = a + b;
a = b;
b = c;

int dp[] = new int[n+1];
dp[n] = 1;
for(int i = n; i>=0; i--){
if(i+1<=n){
dp[i] = dp[i+1];
}
if(i+2<=n){
dp[i] = dp[i+1] + dp[i+2];
}
}
return b;

return dp[0];
}
}

//bottom up
class Solution {

public int climbStairs(int n) {
int[] dp = new int[n + 1];
dp[0] = 1;
dp[1] = 1;

for (int i = 2; i < n + 1; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
}
return dp[n];
}
}

//top down with memo[]
class Solution {

public int climbStairs(int n) {
int[] memo = new int[n + 1];
Arrays.fill(memo, -1);

return climbStairs(n - 1, memo) + climbStairs(n - 2, memo);
}

private int climbStairs(int n, int[] memo) {
if (n < 0) return 0;
if (n == 0 || n == 1) {
memo[n] = 1;
return memo[n];
}
if (memo[n] != -1) return memo[n];

memo[n] = climbStairs(n - 1, memo) + climbStairs(n - 2, memo);
return memo[n];
}
}
}
31 changes: 31 additions & 0 deletions python/horoscopeFinder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

a = int(input("Enter the day of Birth :"))
b = int(input("Enter the month of Birth :"))

# comparing the day and month and assigning the star
if(((b == 12) and (a >= 22 and a <= 31)) or ((b == 1) and (a >= 1 or a <= 20))):
print(" YOUR STAR IS CAPRICON..")
elif(((b == 1) and (a >= 21 and a <= 31)) or ((b == 2) and (a >= 1 and a <= 19))):
print(" YOUR STAR IS AQUARIUS..")
elif(((b == 2) and (a >= 20 and a <= 29)) or ((b == 3) and (a >= 1 and a <= 20))):
print(" YOUR STAR IS PISCES..")
elif(((b == 3) and (a >= 21 and a <= 31)) or ((b == 4) and (a >= 1 and a <= 19))):
print(" YOUR STAR IS ARIES..")
elif(((b == 4) and (a >= 20 and a <= 30)) or ((b == 5) and (a >= 1 and a <= 20))):
print(" YOUR STAR IS TAORUS..")
elif(((b == 5) and (a >= 21 and a <= 31)) or ((b == 6) and (a >= 1 and a <= 21))):
print(" YOUR STAR IS GEMINI..")
elif(((b == 6) and (a >= 22 and a <= 30)) or ((b == 7) and (a >= 1 and a <= 23))):
print(" YOUR STAR IS CANCER..")
elif(((b == 7) and (a >= 24 and a <= 31)) or ((b == 8) and (a >= 1 and a <= 23))):
print(" YOUR STAR IS LEO..")
elif(((b == 8) and (a >= 25 and a <= 31)) or ((b == 9) and (a >= 1 and a <= 22))):
print(" YOUR STAR IS VIRGO..")
elif(((b == 9) and (a >= 23 and a <= 30)) or ((b == 10) and (a >= 1 and a <= 22))):
print(" YOUR STAR IS LIBRA..")
elif(((b == 10) and (a >= 23 and a <= 31)) or ((b == 11) and (a >= 1 and a <= 22))):
print(" YOUR STAR IS SCORPIO..")
elif(((b == 11) and (a >= 23 and a <= 30)) or ((b == 12) and (a >= 1 and a <= 20))):
print(" YOUR STAR IS SCORPIO..")
else:
print("SORRY! Print valid date and month")