diff --git a/All Other Program/Q3.java b/All Other Program/Q3.java new file mode 100644 index 0000000..b1fa5b9 --- /dev/null +++ b/All Other Program/Q3.java @@ -0,0 +1,31 @@ +import java.util.Scanner; + + +class Q3 +{ + public static void main(String args[]) + { + int a,b,c; + Scanner sc = new Scanner(System.in); + System.out.println("Enter the First Number : "); + a = sc.nextInt(); + System.out.println("Enter the Second Number : "); + b = sc.nextInt(); + System.out.println("Enter the Third Number : "); + c = sc.nextInt(); + if(a>b && a>c) + { + System.out.println(a+" is the Biggest Number"); + } + else if(b>a && b>c) + { + System.out.println(b+" is the Biggest Number"); + } + else + { + System.out.println(c+" is the Biggest Number"); + } + + } + +} diff --git a/C++ Programs/Greedy/135-Candy.cpp b/C++ Programs/Greedy/135-Candy.cpp new file mode 100644 index 0000000..ba867ac --- /dev/null +++ b/C++ Programs/Greedy/135-Candy.cpp @@ -0,0 +1,16 @@ +class Solution { +public: + int candy(vector& ratings) { + int sum =0; + vector c (ratings.size(), 1); + for (int i=1;iratings[i-1]) + c[i] = c[i-1]+1; + + for(int i=ratings.size()-2;~i;i--) + if(ratings[i]>ratings[i+1]) c[i] = max(c[i], c[i+1]+1); + + for(auto i: c) sum +=i; + return sum; + } +}; diff --git a/README.md b/README.md index 5bdb631..69634bd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +-NO LONGER ACCEPTING ANY MORE PULL REQUEST! THANK YOU FOR PARTICIPATING- + # Hacktoberfest 2022 ## How to Participate?