diff --git a/PARTICIPANTS.md b/PARTICIPANTS.md index 5cff755..901a4e5 100644 --- a/PARTICIPANTS.md +++ b/PARTICIPANTS.md @@ -89,6 +89,16 @@ - šŸ“« Reach me: **swastikmohapatra13@gmail.com** - šŸ”­ Connect with me: **[SwastikMo](https://github.com/SwastikMo)** +--- +### Connect with me: + + + +- šŸ‘Øā€šŸ’» My name is *r** +- 🌱 I’m a full stack developer. +- šŸ“« Reach me: **hasnaat93@gmail.com** +- šŸ”­ Connect with me: **[hasnaat93](https://github.com/hasnaat93)** + --- ### Connect with me: diff --git a/java/70-Climbing-Stairs.java b/java/70-Climbing-Stairs.java index 4df6c20..12159a4 100644 --- a/java/70-Climbing-Stairs.java +++ b/java/70-Climbing-Stairs.java @@ -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]; - } -} +} \ No newline at end of file diff --git a/python/horoscopeFinder.py b/python/horoscopeFinder.py new file mode 100644 index 0000000..95a78d1 --- /dev/null +++ b/python/horoscopeFinder.py @@ -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")