├── .gitignore ├── C++ Programs ├── array_balancing.c++ ├── tempCodeRunnerFile.c++ ├── integermoves.c++ ├── prove_him_wromg.c++ ├── B_Remove_Prefix.cpp ├── Possible_GCD.cpp ├── maximum_cake_tastiness.c++ ├── gcd_array.c++ ├── dp-starter.cpp ├── mixed_fraction.c++ ├── div+mod.c++ ├── marinB.c++ ├── prefix_removal1.c++ ├── marin_photoshoot.c++ ├── prefix_removal.c++ ├── A_Number_Transformation.cpp ├── game.c++ ├── integermove.c++ ├── max_product_of_a_subarray.cpp ├── reverse_linked_list.cpp ├── A_Food_for_Animals.cpp ├── evaluatePostfix.cpp ├── longest_substring_without_repeating_characters.cpp ├── permutations.cpp ├── Find_minimum_in_rotated_sorted_array.cpp ├── Anticlockwise_Rotation_of_an_array.cpp ├── B_Consecutive_Points_Segment.cpp ├── longest_consecutive_sequence.cpp ├── infToPost.cpp ├── A_Tokitsukaze_and_All_Zero_Sequence.cpp ├── missingNumber.cpp ├── find_first_and_last_position_of_element_in_sorted_array.cpp ├── AggressiveCows.cpp ├── A_Prof_Slim.cpp ├── Detect cycle in an undirected graph.cpp ├── n-queen.cpp ├── search_in_rotated_sorted_array.cpp └── A_Glory_Addicts.cpp ├── Hello World Programs ├── HelloWorld.sh ├── Hello_World.py ├── hello_world.ex ├── hello_world.pl ├── hello_world.rb ├── hello_world.nim ├── HelloWorld.js ├── HelloWorld.ts ├── hello_world.clj ├── hello_world.ml ├── Hello_World.dart ├── hello_world.rkt ├── helloWorld.dart ├── hello_world.hs ├── hello_world.rs ├── hello_world.go ├── hello_world.c ├── HelloWorld.scala ├── HelloWorld.bf ├── HelloWorldProgram.java ├── helloWorld.cs ├── HelloWorld.cpp └── hello_world.asm ├── Android Projects └── LemonApp │ ├── Lemonade │ ├── app │ │ ├── .gitignore │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.webp │ │ │ │ │ │ └── ic_launcher_round.webp │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.webp │ │ │ │ │ │ └── ic_launcher_round.webp │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.webp │ │ │ │ │ │ └── ic_launcher_round.webp │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.webp │ │ │ │ │ │ └── ic_launcher_round.webp │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.webp │ │ │ │ │ │ └── ic_launcher_round.webp │ │ │ │ │ ├── values │ │ │ │ │ │ ├── themes.xml │ │ │ │ │ │ ├── colors.xml │ │ │ │ │ │ └── strings.xml │ │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ │ ├── xml │ │ │ │ │ │ ├── backup_rules.xml │ │ │ │ │ │ └── data_extraction_rules.xml │ │ │ │ │ ├── drawable │ │ │ │ │ │ ├── lemon_restart.xml │ │ │ │ │ │ ├── lemon_squeeze.xml │ │ │ │ │ │ └── ic_launcher_background.xml │ │ │ │ │ └── drawable-v24 │ │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── lemonade │ │ │ │ │ │ ├── ui │ │ │ │ │ │ └── theme │ │ │ │ │ │ │ ├── Color.kt │ │ │ │ │ │ │ ├── Shape.kt │ │ │ │ │ │ │ ├── Type.kt │ │ │ │ │ │ │ └── Theme.kt │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── test │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── lemonade │ │ │ │ │ └── ExampleUnitTest.kt │ │ │ └── androidTest │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── lemonade │ │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── proguard-rules.pro │ │ └── build.gradle │ ├── .idea │ │ ├── .gitignore │ │ ├── compiler.xml │ │ ├── misc.xml │ │ └── gradle.xml │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── build.gradle │ ├── settings.gradle │ ├── gradle.properties │ ├── gradlew.bat │ └── gradlew │ ├── App Demo.gif │ └── README.md ├── Python Programs ├── urlshortner │ ├── requirements.txt │ ├── output.png │ ├── urlshortener.py │ └── README.md ├── qrcodegenerator │ ├── requirements.txt │ ├── qrcode.py │ ├── README.md │ └── hactoberfest.svg ├── Turtle Programs │ ├── index.jpeg │ ├── sketch.png │ ├── cyan circle.py │ ├── rainbow benzene.py │ ├── square design.py │ ├── flower.py │ ├── surprize.py │ └── i love you design.py └── bubble sort .py ├── Netflix Clone └── package.json ├── Frontend Projects ├── FillMe │ ├── assets │ │ └── project.gif │ ├── README.md │ ├── index.html │ ├── scripts │ │ └── script.js │ └── styles │ │ └── style.css ├── Split Screen │ ├── static │ │ └── img │ │ │ ├── bg-bw.jpg │ │ │ └── bg-colored.jpg │ ├── scripts │ │ └── main.js │ ├── index.html │ └── style │ │ └── style.css ├── Temperature-converter │ ├── newimgtemp.jpg │ ├── script.js │ └── index.html ├── Lorem_Ipsum Generator │ ├── index.html │ ├── index.css │ └── index.js ├── tip calculator │ ├── style.css │ └── index.html └── Creating a form ├── C Programs ├── Ascii Value.c ├── dp-starter.c ├── multiplication_matrices.c ├── CountVowConsDigSpac.c ├── Radix Sort.c ├── polynomial.c ├── sparse.c └── Running Median.c ├── Sorting Algorithms ├── selection_sort.cpp ├── bubble_sort.cpp ├── insertion_sort.cpp ├── cyclicSort.cpp ├── shell_sort.cpp ├── Merging_sort.cpp ├── radix_sort.c ├── Heap Sort.cpp ├── radix_sort.cpp └── selection-insertion.c ├── Java Programs ├── Armstrong.java ├── Createfile.java ├── Palindrome.java ├── PalindromeNumber.java ├── Reverse the string Wordwise.java ├── SubSeq.java ├── PatternTriangle.java ├── bubble_sort.java ├── Second_largest_array.java ├── IntegerToRoman.java ├── factors.java ├── RomanToInteger.java ├── Armstrong number.java ├── Merging to Array in sorted order └── PeripheralnodesClockwiseDirection.java ├── Rust Programs ├── BinarySearch.rs ├── PolynomialExpression.rs └── ArrayOperations.rs ├── README.md ├── CONTRIBUTING.md ├── Groovy Programs └── PriorityQueue Implementation.groovy └── Go Programs └── to-doapp.go /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode -------------------------------------------------------------------------------- /C++ Programs/array_balancing.c++: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Hello World Programs/HelloWorld.sh: -------------------------------------------------------------------------------- 1 | echo "Hello World!" -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /Hello World Programs/Hello_World.py: -------------------------------------------------------------------------------- 1 | print("Hello world") -------------------------------------------------------------------------------- /Hello World Programs/hello_world.ex: -------------------------------------------------------------------------------- 1 | IO.puts "Hello, world!" -------------------------------------------------------------------------------- /Hello World Programs/hello_world.pl: -------------------------------------------------------------------------------- 1 | print "Hello World!" -------------------------------------------------------------------------------- /Hello World Programs/hello_world.rb: -------------------------------------------------------------------------------- 1 | puts 'Hello World!' -------------------------------------------------------------------------------- /Hello World Programs/hello_world.nim: -------------------------------------------------------------------------------- 1 | echo "Hello World!" 2 | -------------------------------------------------------------------------------- /Python Programs/urlshortner/requirements.txt: -------------------------------------------------------------------------------- 1 | pyshorteners==1.0.1 -------------------------------------------------------------------------------- /Hello World Programs/HelloWorld.js: -------------------------------------------------------------------------------- 1 | console.log("Hello World!"); 2 | -------------------------------------------------------------------------------- /Hello World Programs/HelloWorld.ts: -------------------------------------------------------------------------------- 1 | console.log("Hello World!") 2 | -------------------------------------------------------------------------------- /Hello World Programs/hello_world.clj: -------------------------------------------------------------------------------- 1 | (println "Hello World!") 2 | -------------------------------------------------------------------------------- /Hello World Programs/hello_world.ml: -------------------------------------------------------------------------------- 1 | print_endline "Hello World!" 2 | -------------------------------------------------------------------------------- /C++ Programs/tempCodeRunnerFile.c++: -------------------------------------------------------------------------------- 1 | { if(a[i] 2 | int main() 3 | { 4 | printf("Hello World!"); 5 | } -------------------------------------------------------------------------------- /Hello World Programs/HelloWorld.scala: -------------------------------------------------------------------------------- 1 | object HelloWorld { 2 | def main(args: Array[String]) { 3 | println("Hello World!") 4 | } 5 | } -------------------------------------------------------------------------------- /Android Projects/LemonApp/App Demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/App Demo.gif -------------------------------------------------------------------------------- /Python Programs/urlshortner/output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Python Programs/urlshortner/output.png -------------------------------------------------------------------------------- /Python Programs/Turtle Programs/index.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Python Programs/Turtle Programs/index.jpeg -------------------------------------------------------------------------------- /Python Programs/Turtle Programs/sketch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Python Programs/Turtle Programs/sketch.png -------------------------------------------------------------------------------- /Frontend Projects/FillMe/assets/project.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Frontend Projects/FillMe/assets/project.gif -------------------------------------------------------------------------------- /C++ Programs/integermoves.c++: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | vector v; 7 | 8 | return 0; 9 | } -------------------------------------------------------------------------------- /Frontend Projects/Split Screen/static/img/bg-bw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Frontend Projects/Split Screen/static/img/bg-bw.jpg -------------------------------------------------------------------------------- /Frontend Projects/Temperature-converter/newimgtemp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Frontend Projects/Temperature-converter/newimgtemp.jpg -------------------------------------------------------------------------------- /Frontend Projects/Split Screen/static/img/bg-colored.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Frontend Projects/Split Screen/static/img/bg-colored.jpg -------------------------------------------------------------------------------- /Hello World Programs/HelloWorld.bf: -------------------------------------------------------------------------------- 1 | >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.>>>++++++++[<++++>-] 2 | <.>>>++++++++++[<+++++++++>-]<---.<<<<.+++.------.--------.>>+.>++++++++++. 3 | -------------------------------------------------------------------------------- /Hello World Programs/HelloWorldProgram.java: -------------------------------------------------------------------------------- 1 | class HelloWorld 2 | { 3 | 4 | public static void main(String args[]) 5 | { 6 | System.out.println("Hello, World"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Python Programs/urlshortner/urlshortener.py: -------------------------------------------------------------------------------- 1 | import pyshorteners 2 | 3 | link = input("\nEnter your link : ") 4 | 5 | short = pyshorteners.Shortener() 6 | x = short.tinyurl.short(link) 7 | 8 | print("\nShorted link is : "+x) -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /Python Programs/qrcodegenerator/qrcode.py: -------------------------------------------------------------------------------- 1 | import pyqrcode 2 | from pyqrcode import QRCode 3 | 4 | qr = "https://github.com/GDSC-MITS/Contribute-To-HacktoberFest" 5 | url = pyqrcode.create(qr) 6 | url.svg("hactoberfest.svg", scale = 8) -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GDSC-MITS/Contribute-To-HacktoberFest/HEAD/Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /C Programs/Ascii Value.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | char ch; 5 | printf("Enter any character:"); 6 | 7 | scanf("%c", &ch); 8 | 9 | printf("ASCII value of character %c is: %d", ch, ch); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /Python Programs/Turtle Programs/cyan circle.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | t=turtle.Turtle() 4 | 5 | t.speed(100) 6 | turtle.bgcolor('black') 7 | 8 | for i in range(240): 9 | t.color('cyan') 10 | t.circle(i) 11 | t.left(5) 12 | turtle.done() 13 | -------------------------------------------------------------------------------- /C++ Programs/prove_him_wromg.c++: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | int n; 11 | cin>>n;//length of array a 12 | 13 | 14 | } 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /Hello World Programs/helloWorld.cs: -------------------------------------------------------------------------------- 1 | // CSharp 2 | using System; 3 | 4 | namespace HelloWorldApp { 5 | class Geeks { 6 | static void Main(string[] args) { 7 | Console.WriteLine("Hello World!"); 8 | Console.ReadKey(); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Hello World Programs/HelloWorld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | ios_base::sync_with_stdio(false); 6 | int t = 1; 7 | cin >> t; 8 | while (t--) 9 | { 10 | cout << "\nHello World"; 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Python Programs/bubble sort .py: -------------------------------------------------------------------------------- 1 | l=[] 2 | n=int(input("Enter number of elemnets : ")) 3 | for i in range(0,n): 4 | l.append(int(input("Enter elements ; "))) 5 | for i in range(0,n): 6 | for i in range(0,n-i-1): 7 | if l[i]>l[i+1]: 8 | l[i],l[i+1]=l[i+1],l[i] 9 | print("Sorted list\n",l) -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /Python Programs/Turtle Programs/rainbow benzene.py: -------------------------------------------------------------------------------- 1 | # draw rainbow benzene 2 | import turtle as t 3 | colors = ["red","purple","green","orange","blue","violet"] 4 | t.pen() 5 | t.bgcolor("black") 6 | for x in range(360): 7 | t.pencolor(colors[x%6]) 8 | t.width(x//100 + 1) 9 | t.fd(x) 10 | t.lt(59) 11 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 16 13:41:56 IST 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/java/com/example/lemonade/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | package com.example.lemonade.ui.theme 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | val Purple200 = Color(0xFFBB86FC) 6 | val Purple500 = Color(0xFF6200EE) 7 | val Purple700 = Color(0xFF3700B3) 8 | val Teal200 = Color(0xFF03DAC5) -------------------------------------------------------------------------------- /Frontend Projects/FillMe/README.md: -------------------------------------------------------------------------------- 1 | # Fill Me 2 | 3 | A short fun type of task where boxes can be filled with colors by clicking on the boxes and removed after again tap into it. 4 | 5 | ## Preview 6 | 7 | ![Fill Me screenshot](./assets/project.gif) 8 | 9 | Live View: [Click Here](https://aniloli42.github.io/fill-me/) 10 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /C++ Programs/B_Remove_Prefix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | int k; 11 | cin>>k; 12 | vector v; 13 | while(k--) 14 | { 15 | v.push_back(k); 16 | } 17 | 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Python Programs/Turtle Programs/square design.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | from random import randint 3 | speed(0) 4 | bgcolor("black") 5 | x = 1 6 | while x < 400: 7 | r = randint(0,255) 8 | g = randint(0,255) 9 | b = randint(0,255) 10 | colormode(255) 11 | pencolor(r,g,b) 12 | fd(50+x) 13 | rt(90.911) 14 | x+=1 15 | exitonclick() -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/README.md: -------------------------------------------------------------------------------- 1 | # Lemonade App 2 | 3 | ### A Beginner's app to Learn the basics of Compose 4 | 5 | ### Lemonade App is a simple, interactive app that lets you juice lemons when you tap the image on screen until you have a glass of lemonade 6 | 7 | ### Demo 8 | ![Lemonade App](https://github.com/milandeepak/Contribute-To-HacktoberFest/blob/6c3de6d495a5e4726af674622640a3b02eb0d5b9/LemonApp/App%20Demo.gif) 9 | -------------------------------------------------------------------------------- /C++ Programs/Possible_GCD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | // your code goes here 6 | int t,A,B; 7 | cin>>t; 8 | while(t) 9 | { 10 | cin>>A; 11 | cin>>B; 12 | 13 | for(int i=1;i 2 | 3 | int dp[1000001] = {-1}; 4 | 5 | int func(int n){ 6 | if(n<=0) return n; 7 | if(n==1) return 1; 8 | if(dp[n]!=-1) return dp[n]; 9 | return dp[n] = func(n-1) + func(n-2); 10 | } 11 | 12 | int main() { 13 | int n ; 14 | scanf("%d", &n); 15 | for (int i = 0; i < 1000001; i++) 16 | dp[i]=-1; 17 | int ans = func(n); 18 | printf("%d", ans); 19 | } -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/java/com/example/lemonade/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | package com.example.lemonade.ui.theme 2 | 3 | import androidx.compose.foundation.shape.RoundedCornerShape 4 | import androidx.compose.material.Shapes 5 | import androidx.compose.ui.unit.dp 6 | 7 | val Shapes = Shapes( 8 | small = RoundedCornerShape(4.dp), 9 | medium = RoundedCornerShape(4.dp), 10 | large = RoundedCornerShape(0.dp) 11 | ) -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | compose_ui_version = '1.1.1' 4 | } 5 | }// Top-level build file where you can add configuration options common to all sub-projects/modules. 6 | plugins { 7 | id 'com.android.application' version '7.3.0' apply false 8 | id 'com.android.library' version '7.3.0' apply false 9 | id 'org.jetbrains.kotlin.android' version '1.6.10' apply false 10 | } -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | rootProject.name = "Lemonade" 16 | include ':app' 17 | -------------------------------------------------------------------------------- /C++ Programs/maximum_cake_tastiness.c++: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | {int t; 6 | cin>>t; 7 | while(t--) 8 | { 9 | int n; 10 | cin>>n; 11 | vector v; 12 | for(int i =0;i>x; 16 | v.push_back(x); 17 | } 18 | sort(v.begin(),v.end()); 19 | cout< 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/test/java/com/example/lemonade/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.lemonade 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /Python Programs/urlshortner/README.md: -------------------------------------------------------------------------------- 1 | # This program shortens long links to short links 2 | 3 | 4 | #### Requirements 5 | 6 | ``` 7 | $pip install pyshorteners 8 | ``` 9 | 10 | #### Usage 11 | 12 | Download this folder and run the program in your terminal 13 | 14 | ``` 15 | $ python urlshortner.py 16 | ``` 17 | 18 | #### Output 19 | 20 | ![Output](https://github.com/milandeepak/Contribute-To-HacktoberFest/blob/9d10c083a9bd432f7ac5b2c7ec8d27bc2d9250b2/Python%20Programs/urlshortner/output.png) 21 | -------------------------------------------------------------------------------- /C++ Programs/gcd_array.c++: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | int l,r,k; 11 | cin>>l>>r>>k; 12 | vector v; 13 | for(int i=l;l<=r;++i) 14 | { 15 | v.push_back(i); 16 | } 17 | sort(v.begin(),v.end()); 18 | if(v[0]%2==0) 19 | { 20 | for(int i=1;i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | -------------------------------------------------------------------------------- /C++ Programs/dp-starter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define vi vector 4 | #define vs vector 5 | #define sz(v) v.size() 6 | #define all(v) v.begin(),v.end() 7 | #define ll long long 8 | 9 | vector dp(1000001,-1); 10 | 11 | int func(int n){ 12 | if(n<=0) return n; 13 | if(n==1) return 1; 14 | if(dp[n]!=-1) return dp[n]; 15 | return dp[n] = func(n-1) + func(n-2); 16 | } 17 | 18 | signed main() { 19 | int n ; 20 | cin >> n ; 21 | int ans = func(n); 22 | cout<< ans << '\n'; 23 | } -------------------------------------------------------------------------------- /C++ Programs/mixed_fraction.c++: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int x1,x2,y1,y2,a,b,c,d; 7 | int area; 8 | cin>>x1>>y1>>x2>>y2; 9 | cin>>a>>c>>b>>d; 10 | int a1=(x2-x1)*(y2-y1); 11 | int a2=(c-a)*(d-b); 12 | int li=max(a,x1); 13 | int ri=min(x2,c); 14 | int bi=max(y1,b); 15 | int ui=min(y2,d); 16 | int inta=(ri-li)*(ui-li); 17 | // overlapping case 18 | if((li 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | 11 | int l,r,a; 12 | cin>>l>>r>>a; 13 | int t=l%a,e; 14 | for(int i=l;i<=r;++i) 15 | { 16 | if(i%a>t) 17 | { 18 | t=i%a; 19 | e=i; 20 | } 21 | } 22 | if(t==l%a) 23 | { 24 | cout<< t +round(l/a)< 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | unsigned long long int n,fact=1,mod=998244353; 11 | cin>>n; 12 | if(n%2==0) 13 | { 14 | for(unsigned long long int i=1; i<=n/2; ++i) 15 | {fact = ((fact %mod)* (i%mod))%mod; 16 | } 17 | cout<<((fact%mod)*(fact%mod))%mod< 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | string s; 11 | cin>>s; 12 | for(int i=0;i 8 | 9 | 13 | -------------------------------------------------------------------------------- /C++ Programs/marin_photoshoot.c++: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | int n; 11 | cin>>n; 12 | string s; 13 | cin>>s; 14 | int female=0; 15 | for(int i=1;i 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t,a; 7 | cin>>t; 8 | while(t--) 9 | { 10 | string s; 11 | cin>>s; 12 | if(s.length()%2==0) 13 | { a=(s.length())/2;} 14 | else{ 15 | a=((s.length()-1)/2); 16 | } 17 | for(int i=0;i 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | 7 | int n; 8 | cin>>n; 9 | int a[n]; 10 | for(int i=0;i>a[i]; 12 | } 13 | //slection sort algo 14 | for(int i=0;i 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | int n; 7 | cin>>n; 8 | int a[n]; 9 | for(int i=0;i>a[i]; 11 | } 12 | //bubble sort algo 13 | int count =1; 14 | while (counta[i+1]){ 18 | int temp=a[i]; 19 | a[i]=a[i+1]; 20 | a[i+1]=temp; 21 | } 22 | } 23 | count++; 24 | } 25 | 26 | for(int i=0;i { 6 | container.classList.add("hover-left"); 7 | }); 8 | 9 | left.addEventListener("mouseleave", () => { 10 | container.classList.remove("hover-left"); 11 | }); 12 | 13 | right.addEventListener("mouseenter", () => { 14 | container.classList.add("hover-right"); 15 | }); 16 | 17 | right.addEventListener("mouseleave", () => { 18 | container.classList.remove("hover-right"); 19 | }); -------------------------------------------------------------------------------- /Java Programs/Armstrong.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class Armstrong 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner sc=new Scanner(System.in); 7 | int n,temp,sum=0,r; 8 | System.out.println("Enter a three digit number: "); 9 | n=sc.nextInt(); 10 | temp=n; 11 | while(n!=0) 12 | { 13 | r=n%10; 14 | sum=sum+(r*r*r); 15 | n=n/10; 16 | } 17 | if(sum==temp) 18 | System.out.println("\nArmstrong"); 19 | else 20 | System.out.println("\nNot Armstrong"); 21 | } 22 | } -------------------------------------------------------------------------------- /Sorting Algorithms/insertion_sort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | int n; 7 | cin>>n; 8 | int a[n]; 9 | for(int i=0;i>a[i]; 11 | } 12 | for(int i=1;icurrent && j>=0) 16 | { 17 | a[j+1]=a[j]; 18 | j--; 19 | /* code */ 20 | } 21 | a[j+1]=current; 22 | 23 | for(int i=0;i 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | long int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | int x,y; 11 | cin>>x>>y; 12 | int a=1,b=1; 13 | for(long long int i=0;i 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | int n,x,coins=0; 11 | cin>>n; 12 | vector v; 13 | for(int i=0;i>x; 16 | v.push_back(x); 17 | } 18 | for(int i=1;i 2 | Lemonade 3 | Tap the lemon tree to select a lemon 4 | Keep tapping the lemon to squeeze it 5 | Tap the lemonade to drink it 6 | Tap the empty glass to start again 7 | Lemon tree 8 | Lenom 9 | Glass of Lemonade 10 | Empty Glass 11 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /C++ Programs/integermove.c++: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | 9 | int main() { 10 | /* Enter your code here. Read input from STDIN. Print output to STDOUT */ 11 | int n,q,x,c,d; 12 | 13 | cin>>n>>q; 14 | vector> v; 15 | for(int i=0;i>x; 18 | 19 | v[i].push_back(x); 20 | 21 | cout<<"value taken "<>c>>d; 26 | cout<<"\n"; 27 | cout< 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /Java Programs/Palindrome.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class Palindrome { 3 | public static void main(String args[]) 4 | { 5 | Scanner sc=new Scanner(System.in); 6 | int i,j,flag=0; 7 | System.out.println("Enter a string"); 8 | String str=sc.next(); 9 | i=0; 10 | j=str.length()-1; 11 | while(i 2 | using namespace std; 3 | 4 | int maxProduct(vector& nums) { 5 | int tmn = 1, tmx = 1; 6 | int ans = INT_MIN; 7 | for(int i=0; i>n; 23 | vector arr(n); 24 | 25 | for(int i=0; i>arr[i]; 27 | } 28 | 29 | cout<<"The maximum product of a subarray in array is: "<next!=NULL) 19 | { 20 | ListNode* curr1=curr->next; 21 | curr->next=prev; 22 | prev=curr; 23 | curr=curr1; 24 | } 25 | head=curr; 26 | curr->next=prev; 27 | return head; 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/androidTest/java/com/example/lemonade/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.lemonade 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.example.lemonade", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /C++ Programs/A_Food_for_Animals.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin >> t; 8 | for (int i = 0; i < t; i++) 9 | { 10 | int a, b, c, x, y; 11 | cin >> a >> b >> c >> x >> y; 12 | 13 | if (a >= x && b >= y) 14 | { 15 | cout << "YES" << endl; 16 | } 17 | else if (a < x && b > y && a + c >= x) 18 | { 19 | cout << "YES" << endl; 20 | } 21 | else if (a > x && b < y && b + c >= y) 22 | { 23 | cout << "YES" << endl; 24 | } 25 | 26 | else if (a < x && b < y && a+b+c >= x+y) 27 | { 28 | cout << "YES" << endl; 29 | } 30 | else 31 | { 32 | cout << "NO" << endl; 33 | } 34 | } 35 | 36 | 37 | return 0; 38 | } -------------------------------------------------------------------------------- /Frontend Projects/Lorem_Ipsum Generator/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Lorem Ipsum Project 10 | 11 | 12 | 13 |
14 |

Generate Some lorem Ipsum

15 |
16 | 17 | 18 | 19 |
20 |
21 |
22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Frontend Projects/Split Screen/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Split Screen 8 | 9 | 10 | 11 | 12 |
13 |
14 |

15 | blue is depth 16 |

17 |
18 |
19 |

20 | black is power 21 |

22 |
23 |
24 | 25 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Python Programs/Turtle Programs/i love you design.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from turtle import * 3 | 4 | wn = Screen() 5 | wn.bgcolor('black') 6 | 7 | t = turtle.Turtle() 8 | t.pencolor('white') 9 | 10 | def curve(): 11 | for i in range(200): 12 | t.rt(1) 13 | t.fd(1) 14 | 15 | def heart(): 16 | t.fillcolor('red') 17 | t.begin_fill() 18 | t.lt(140) 19 | t.fd(113) 20 | curve() 21 | t.lt(120) 22 | curve() 23 | t.fd(112) 24 | t.end_fill() 25 | 26 | heart() 27 | t.ht() 28 | 29 | def write(message,pos): 30 | x,y=pos 31 | t.penup() 32 | t.goto(x,y) 33 | t.color('white') 34 | style=('Stencil Std', 18, 'italic') 35 | t.write(message,font=style) 36 | 37 | write('I',(-68,95)) 38 | write('L',(-55,95)) 39 | write('O',(-42,95)) 40 | write('V',(-30,95)) 41 | write('E',(-14,95)) 42 | write('Y',(10,95)) 43 | write('O',(26,95)) 44 | write('U',(45,95)) 45 | 46 | wn.mainloop() -------------------------------------------------------------------------------- /C++ Programs/evaluatePostfix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int evalPos(char* pos){ 5 | int c; int i{0},j{0},top{-1}; 6 | int s[20]={}; 7 | s[++top]='#'; 8 | for(i=0;i>pos; 33 | cout<< evalPos(pos); 34 | 35 | } -------------------------------------------------------------------------------- /Frontend Projects/FillMe/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Fill Me 9 | 10 | 11 | 12 | 13 |

Fill Me

14 |

Hacktober 2022

15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 |
30 | → Available Colors → 31 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /C++ Programs/longest_substring_without_repeating_characters.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int lengthOfLongestSubstring(string s) { 5 | if(s.empty()) return 0; 6 | if(s.size() <= 1){ 7 | return 1; 8 | } 9 | unordered_map mp; 10 | int start = 0, end = 0; 11 | int n = s.size(); 12 | int ans = 1; 13 | while(end < n){ 14 | mp[s[end]]++; 15 | if(start < end && mp[s[end]] > 1){ 16 | while(mp[s[end]] > 1){ 17 | mp[s[start]]--; 18 | start++; 19 | } 20 | } 21 | else{ 22 | ans = max(ans, end-start+1); 23 | } 24 | end++; 25 | } 26 | return ans; 27 | } 28 | 29 | int main(){ 30 | 31 | string s; 32 | cin>>s; 33 | 34 | cout<<"The Longest Substring Without Repeating Characters is: "< array[mid as usize] { 24 | ll = mid as i32; 25 | } else if qu < array[mid as usize] { 26 | ul = mid as i32; 27 | } 28 | mid = (ll + ul) / 2; 29 | } 30 | if flag { 31 | println!("No Element Found"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Java Programs/PalindromeNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | An integer is a palindrome when it reads the same backward as forward. 3 | For example, 121 is a palindrome while 123 is not. 4 | */ 5 | 6 | import java.util.Scanner; 7 | 8 | public class PalindromeNumber{ 9 | public static void main(String args[]) { 10 | Scanner sc = new Scanner(System.in); 11 | int x = sc.nextInt(); 12 | if(isPalindrome(x)) { 13 | System.out.println("It is Palindrome Number"); 14 | } else { 15 | System.out.println("It is not Palindrome Number"); 16 | } 17 | } 18 | 19 | static boolean isPalindrome(int x) { 20 | if (x < 0 ) { 21 | return false; 22 | } 23 | int revDigit = 0; 24 | int temp = x; 25 | while (temp != 0) { 26 | int r = temp % 10; 27 | revDigit = revDigit*10 + r; 28 | temp = temp / 10; 29 | } 30 | if (x == revDigit) return true; 31 | return false; 32 | } 33 | } -------------------------------------------------------------------------------- /Java Programs/Reverse the string Wordwise.java: -------------------------------------------------------------------------------- 1 | /*Here basically in this question 2 | We will be given String and we have to Reverse the String Wordwise 3 | Example 4 | Input : Welcome to Hacktoberfest 5 | Output: Hacktoberfest to Welcome 6 | */ 7 | This is the snippet for the function 8 | public static String reverseWordWise(String str) { 9 | // This code is basically 3 pointer appr 10 | int n = str.length(); 11 | String rev=""; 12 | int i,j=0,k=0; 13 | for(i=n-1;i>=0;i--) 14 | { 15 | rev = rev+str.charAt(i); 16 | } 17 | String ans=""; 18 | for(i=0;i=k;m--) 24 | { 25 | ans+=rev.charAt(m); 26 | } 27 | ans+=rev.charAt(i); 28 | k=i+1; 29 | } 30 | } 31 | j=i-1; 32 | for(int m=j;m>=k;m--) 33 | { 34 | ans+=rev.charAt(m); 35 | } 36 | return ans; 37 | } 38 | 39 | Hope you enjoyed 40 | Thank you!! 41 | -------------------------------------------------------------------------------- /Java Programs/SubSeq.java: -------------------------------------------------------------------------------- 1 | package com.company; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class SubSeq { 6 | public static void main(String[] args) { 7 | // subseq("","abcdefgh"); 8 | System.out.println(subseq1("","abc")); 9 | } 10 | static void subseq(String p,String up){ 11 | if(up.isEmpty()){ 12 | System.out.println(p); 13 | return; 14 | } 15 | char ch = up.charAt(0); 16 | 17 | subseq(p+ch,up.substring(1)); 18 | subseq(p,up.substring(1)); 19 | } 20 | static ArrayList subseq1(String p, String up){ 21 | if(up.isEmpty()){ 22 | ArrayList list = new ArrayList(); 23 | list.add(p); 24 | return list; 25 | } 26 | char ch = up.charAt(0); 27 | 28 | ArrayList left = subseq1(p+ch,up.substring(1)); 29 | ArrayList right = subseq1(p,up.substring(1)); 30 | left.addAll(right); 31 | return left; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /C++ Programs/permutations.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | vector> ans; 5 | 6 | void func(vector& nums,int i,vector v){ 7 | if(i == nums.size()){ 8 | ans.push_back(v); 9 | return; 10 | } 11 | for(int k=i; k> permute(vector& nums) { 21 | vectorv; 22 | func(nums,0,v); 23 | return ans; 24 | } 25 | 26 | int main(){ 27 | 28 | int n; 29 | cin>>n; 30 | vector arr(n); 31 | 32 | for(int i=0; i>arr[i]; 34 | } 35 | 36 | auto finans = permute(arr); 37 | cout<<"All possible permutation for given array are:"< 2 | using namespace std; 3 | 4 | int findMin(vector& nums) { 5 | int n = nums.size(); 6 | if(n == 0) return -1; 7 | int low = 0; 8 | int high = n-1; 9 | 10 | if(nums[low] <= nums[high]){ 11 | return nums[0]; 12 | } 13 | 14 | int pos = -1; 15 | while(low <= high){ 16 | int mid = low + (high - low)/2; 17 | if(nums[mid]= nums[0]){ 21 | low = mid + 1; 22 | } 23 | else{ 24 | high = mid - 1; 25 | } 26 | } 27 | return nums[pos]; 28 | } 29 | 30 | int main(){ 31 | 32 | int n; 33 | cin>>n; 34 | vector arr(n); 35 | 36 | for(int i=0; i>arr[i]; 38 | } 39 | 40 | cout<<"The minimum element in rotated sorted array is: "< a[j + 1]) { 19 | temp = a[j]; 20 | a[j] = a[j + 1]; 21 | a[j + 1] = temp; 22 | } 23 | } 24 | } 25 | System.out.println("The sorted array is: \n"); 26 | for (i = 0; i < n; i++) { 27 | System.out.print(a[i] + "\t"); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /C Programs/multiplication_matrices.c: -------------------------------------------------------------------------------- 1 | #include 2 | // function to read a matrix 3 | void readmat(int A[][5],int *m,int *n) 4 | { 5 | int i,j; 6 | printf("\nEnter order "); 7 | scanf("%d%d",m,n); 8 | printf("\nEnter the matrix\n"); 9 | for(i=0;i<*m;i++) 10 | for(j=0;j<*n;j++) 11 | scanf("%d",&A[i][j]); 12 | } 13 | // function to multiply the given matrices 14 | void multimat(int A[][5],int B[][5],int C[][5],int m,int n,int p,int q) 15 | { 16 | int i,j,k; 17 | for(i=0;i 2 | using namespace std; 3 | int main() { 4 | cout<<"Program To Rotate An Array in Anticlockwise direction"<>as; 8 | int array[as]; 9 | cout<<"Please input array elements one by one:"<>array[i]; 13 | } 14 | 15 | int temp[as]; 16 | cout<<"please input the shifting constant"<>a; 25 | for(int i=0;i 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | int n,y=1; 11 | cin>>n; 12 | vector v; 13 | int m,count3=0,count2=0; 14 | for(int i=0;i>m; 17 | v.push_back(m); 18 | } 19 | // for(int i=0;i1;++i) 20 | // { 21 | // if((v[i+1]-v[i])==3) 22 | // { 23 | // count3++; 24 | // continue; 25 | // } 26 | // else if((v[i+1]-v[i])==2) 27 | // { 28 | // count2++; 29 | // } 30 | // else if((v[i+1]-v[i])==1) 31 | // { 32 | // continue; 33 | // } 34 | // else{ 35 | // y=0; 36 | // break; 37 | 38 | // // } 39 | // } 40 | // if(y==0 || count2>3 || count3>1) 41 | // { 42 | // cout<<"NO"< 2 | using namespace std; 3 | 4 | int longestConsecutive(vector& nums) { 5 | if(nums.empty()) return 0; 6 | 7 | int n = nums.size(); 8 | unordered_map mp; 9 | for(int i=0; i>n; 36 | vector arr(n); 37 | 38 | for(int i=0; i>arr[i]; 40 | } 41 | 42 | cout<<"The length of the longest consecutive elements sequence is: "<large) 19 | { 20 | large=num[i]; 21 | index=i; 22 | } 23 | for(i=0;inum[sec_large]) 26 | { 27 | num[sec_large]=num[i]; 28 | sec_large=i; 29 | } 30 | System.out.println("Second Largest number in the given array is "+num[sec_large]); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /C++ Programs/infToPost.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int sp(char c){ 5 | if(c=='+'||c=='-') return 2; 6 | if(c=='*'||c=='/') return 4; 7 | if(c=='^'||c=='$') return 5; 8 | if(c=='(') return 0; 9 | if(c=='#') return -1; 10 | return 8; 11 | } 12 | 13 | int ip(char c){ 14 | if(c=='+'||c=='-') return 1; 15 | if(c=='*'||c=='/') return 3; 16 | if(c=='^'||c=='$') return 6; 17 | if(c=='(') return 9; 18 | if(c==')') return 0; 19 | return 7; 20 | } 21 | 22 | char* infToPos(char* inf, char* pos, int n){ 23 | char c; int i{0},j{0},top{-1}; 24 | char s[20]={}; 25 | s[++top]='#'; 26 | for(i=0;iip(c)){ 29 | pos[j++]=s[top--]; 30 | } 31 | if(sp(s[top])!=ip(c)){ 32 | s[++top]=c; 33 | }else{ 34 | top--; 35 | } 36 | } 37 | while(s[top]!='#'){ 38 | pos[j++]=s[top--]; 39 | } 40 | pos[j]='\0'; 41 | return pos; 42 | } 43 | 44 | 45 | 46 | int main() { 47 | 48 | char inf[20]="(A+B)*C", pos[20]; 49 | 50 | int n = strlen(inf); 51 | 52 | cout<< infToPos(inf,pos,n); 53 | 54 | } -------------------------------------------------------------------------------- /Sorting Algorithms/cyclicSort.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | @file cyclicSort.cpp 3 | * @brief Solved the Cyclic sort algorithm; 4 | * 5 | * Input Format: 6 | * First line contaions a single integer n, representing size of thw array 7 | * Second line contaions n space seperated integers, the elements of array 8 | * 9 | * Output Format: 10 | * Sorted array of size N 11 | 12 | * Note: For cyclic sort algorithm array elements needs to be in range from [1 to n]. Only then it will work. 13 | */ 14 | 15 | #include 16 | #include 17 | using namespace std; 18 | 19 | int main() 20 | { 21 | int n; 22 | cin >> n; 23 | vector arr(n); 24 | 25 | for(int i=0; i> arr[i]; 27 | } 28 | 29 | int i = 0; 30 | 31 | while (i < arr.size()) 32 | { 33 | int correct = arr[i]; 34 | correct--; 35 | 36 | if (arr[i] != arr[correct]) 37 | { 38 | swap(arr[i], arr[correct]); 39 | } 40 | else 41 | { 42 | i++; 43 | } 44 | } 45 | 46 | cout << "After Sorting array: "; 47 | 48 | for (int i = 0; i < n; i++) 49 | { 50 | cout << arr[i] << " "; 51 | } 52 | 53 | return 0; 54 | } -------------------------------------------------------------------------------- /Rust Programs/PolynomialExpression.rs: -------------------------------------------------------------------------------- 1 | // Polynomial using Array 2 | use text_io::read; 3 | #[derive(Debug)] 4 | struct Polynomial { 5 | coeff: i32, 6 | expo: i32, 7 | } 8 | impl Polynomial { 9 | fn new() -> Polynomial { 10 | Polynomial { coeff: 0, expo: 0 } 11 | } 12 | } 13 | 14 | fn main() { 15 | print!("Degree of polynomial: "); 16 | let n: usize = read!(); 17 | let mut p1: Vec = (0..n).map(|_| Polynomial::new()).collect(); 18 | let mut i: usize = 0; 19 | println!("First"); 20 | while i < n { 21 | print!("Coefficent: "); 22 | p1[i].coeff = read!(); 23 | print!(r#"Exponent: "#); 24 | p1[i].expo = read!(); 25 | i += 1; 26 | } 27 | println!(); 28 | for j in 0..n { 29 | if p1[j].coeff == 0 { 30 | continue; 31 | } else if p1[j].expo == 0 { 32 | print!("{}", p1[j].coeff); 33 | } else if p1[j].expo == 1 { 34 | print!("{}x", p1[j].coeff); 35 | } else if p1[j].coeff == 1 { 36 | print!("x^{}", p1[j].expo); 37 | } else { 38 | print!("{}x^{}", p1[j].coeff, p1[j].expo); 39 | } 40 | if j < i - 1 { 41 | print!(" + "); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Java Programs/IntegerToRoman.java: -------------------------------------------------------------------------------- 1 | /* 2 | The program converts the given Integer to Roman number. 3 | INPUT: 2022 4 | OUTPUT: MMXXII 5 | */ 6 | 7 | import java.util.LinkedHashMap; 8 | import java.util.Scanner; 9 | 10 | public class IntegerToRoman { 11 | public static void main(String args[]) { 12 | String ans = ""; 13 | Scanner sc = new Scanner(System.in); 14 | int num = sc.nextInt(); 15 | LinkedHashMap map = new LinkedHashMap<>(); 16 | 17 | map.put(1000, "M"); 18 | map.put(900, "CM"); 19 | map.put(500, "D"); 20 | map.put(400, "CD"); 21 | map.put(100, "C"); 22 | map.put(90, "XC"); 23 | map.put(50, "L"); 24 | map.put(40, "XL"); 25 | map.put(10, "X"); 26 | map.put(9, "IX"); 27 | map.put(5, "V"); 28 | map.put(4, "IV"); 29 | map.put(1, "I"); 30 | 31 | while (num > 0) { 32 | for (int i : map.keySet()) { 33 | if (num >= i) { 34 | ans += map.get(i); 35 | num -= i; 36 | break; 37 | } 38 | } 39 | } 40 | System.out.println("Result: " + ans); 41 | } 42 | } 43 | 44 | Hope it is helpful 45 | Thank You 46 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /C++ Programs/A_Tokitsukaze_and_All_Zero_Sequence.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin >> t; 8 | while (t--) 9 | { 10 | int n, m, count = 0, u; 11 | cin >> n; 12 | u = n; 13 | vector v; 14 | for (int i = 0; i < n; ++i) 15 | { 16 | cin >> m; 17 | v.push_back(m); 18 | } 19 | for (int i = 0; i < n; ++i) 20 | { 21 | if (v[i] == 0) 22 | { 23 | count = 0; 24 | break; 25 | } 26 | else 27 | { 28 | for (int j = 0; j < u; j++) 29 | { 30 | if (v[i] == v[j]) 31 | { 32 | count = 0; 33 | break; 34 | } 35 | else 36 | { 37 | count = 1; 38 | } 39 | u--; 40 | } 41 | } 42 | } 43 | if (count == 0) 44 | { 45 | cout << n - 1 << endl; 46 | } 47 | else 48 | { 49 | cout << n+1 << endl; 50 | } 51 | } 52 | return 0; 53 | } -------------------------------------------------------------------------------- /Frontend Projects/Temperature-converter/script.js: -------------------------------------------------------------------------------- 1 | function tempConvert() 2 | { 3 | var fahrenheit = document.getElementById("fahrenheit").value; 4 | var celsius = document.getElementById("celsius").value; 5 | var kelvin = document.getElementById("kelvin").value; 6 | 7 | if (fahrenheit != '' && celsius =='' && kelvin =='') 8 | { 9 | celsius = (parseFloat(fahrenheit) - 32) / 1.8; 10 | kelvin = ((parseFloat(fahrenheit) - 32)/1.8) +273.15; 11 | } 12 | else if (celsius !='' && fahrenheit =='' && kelvin=='') 13 | { 14 | fahrenheit = (parseFloat(celsius) * 1.8) + 32; 15 | kelvin =(parseFloat(celsius)+273.15); 16 | } 17 | else 18 | { 19 | fahrenheit=(parseFloat(kelvin-273.15)*1.8)+32; 20 | celsius=(parseFloat(kelvin)-273.15); 21 | } 22 | 23 | document.getElementById('fahrenheit').value = parseFloat(fahrenheit).toFixed(1); 24 | document.getElementById('celsius').value = parseFloat(celsius).toFixed(1); 25 | document.getElementById('kelvin').value=parseFloat(kelvin).toFixed(1); 26 | } 27 | 28 | 29 | function ClearForm() 30 | { 31 | document.getElementById('fahrenheit').value = ''; 32 | document.getElementById('kelvin').value = ''; 33 | document.getElementById('celsius').value = ''; 34 | } 35 | -------------------------------------------------------------------------------- /Sorting Algorithms/shell_sort.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file shell_sort.cpp 3 | * @brief Solved the shell sort algorithm; 4 | * 5 | * Input Format: 6 | * First line contaions a single integer n, representing size of thw array 7 | * Second line contaions n space seperated integers, the elements of array 8 | * 9 | * Output Format: 10 | * Sorted array of size N 11 | */ 12 | 13 | #include 14 | using namespace std; 15 | 16 | // Shell sort 17 | void shellSort(int array[], int n) { 18 | // Rearrange elements at each n/2, n/4, n/8, ... intervals 19 | for (int interval = n / 2; interval > 0; interval /= 2) { 20 | for (int i = interval; i < n; i += 1) { 21 | int temp = array[i]; 22 | int j; 23 | for (j = i; j >= interval && array[j - interval] > temp; j -= interval) { 24 | array[j] = array[j - interval]; 25 | } 26 | array[j] = temp; 27 | } 28 | } 29 | } 30 | 31 | // Print an array 32 | void printArray(int array[], int size) { 33 | int i; 34 | for (i = 0; i < size; i++) cout << array[i] << " "; 35 | cout << endl; 36 | } 37 | 38 | // Driver code 39 | int main() { 40 | int n; 41 | cin >> n; 42 | int arr[n]; 43 | for (int i = 0; i < n; i++) { 44 | cin >> arr[i]; 45 | } 46 | 47 | shellSort(arr, n); 48 | cout << "Sorted array: \n"; 49 | printArray(arr, n); 50 | } -------------------------------------------------------------------------------- /C++ Programs/missingNumber.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | @file missingNumer.cpp 3 | * @brief Solved the Missing number problem; 4 | * 5 | * Question :- Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array. 6 | * 7 | * Input Format: 8 | * First line contaions a single integer n, representing size of thw array 9 | * Second line contaions n space seperated integers, the elements of array 10 | * 11 | * Output Format: 12 | * It outputs the missing number. 13 | */ 14 | 15 | #include 16 | #include 17 | using namespace std; 18 | 19 | int main() 20 | { 21 | int n; 22 | cin >> n; 23 | 24 | vector arr(n); 25 | 26 | for (int i = 0; i < n; i++) 27 | { 28 | cin >> arr[i]; 29 | } 30 | 31 | int i = 0; 32 | 33 | while (i < arr.size()) 34 | { 35 | int correct = arr[i]; 36 | 37 | if (arr[i] < arr.size() && arr[i] != arr[correct]) 38 | { 39 | swap(arr[i], arr[correct]); 40 | } 41 | else 42 | { 43 | i++; 44 | } 45 | } 46 | 47 | for (int index = 0; index < arr.size(); index++) 48 | { 49 | if (arr[index] != index) 50 | { 51 | cout << index << endl; 52 | } 53 | } 54 | 55 | return 0; 56 | } -------------------------------------------------------------------------------- /Java Programs/factors.java: -------------------------------------------------------------------------------- 1 | //This is the program to find the factors of the given number 2 | 3 | import java.util.ArrayList; 4 | 5 | public class factors { 6 | public static void main(String[] args) { 7 | int num = 20; 8 | factors1(num); 9 | System.out.println(); 10 | factors2(num); 11 | } 12 | 13 | //Unsorted 14 | static void factors1(int n){ 15 | for(int i = 1; i <= Math.sqrt(n); i++){ 16 | if(n%i == 0){ 17 | if(n/i == i){ 18 | System.out.print(i + " "); 19 | }else{ 20 | System.out.print(i + " " + n/i + " "); 21 | } 22 | } 23 | } 24 | } 25 | 26 | //Sorted - here the time and space complexity will be sqrt(n) 27 | static void factors2(int n){ 28 | ArrayList list = new ArrayList<>(); 29 | for(int i = 1; i <= Math.sqrt(n); i++){ 30 | if(n%i == 0){ 31 | if(n/i == i){ 32 | System.out.print(i + " "); 33 | }else{ 34 | System.out.print(i + " "); 35 | list.add(n/i); 36 | } 37 | } 38 | } 39 | for(int i = list.size() - 1; i >= 0; i--){ 40 | System.out.print(list.get(i) + " " ); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/java/com/example/lemonade/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.example.lemonade.ui.theme 2 | 3 | import androidx.compose.foundation.isSystemInDarkTheme 4 | import androidx.compose.material.MaterialTheme 5 | import androidx.compose.material.darkColors 6 | import androidx.compose.material.lightColors 7 | import androidx.compose.runtime.Composable 8 | 9 | private val DarkColorPalette = darkColors( 10 | primary = Purple200, 11 | primaryVariant = Purple700, 12 | secondary = Teal200 13 | ) 14 | 15 | private val LightColorPalette = lightColors( 16 | primary = Purple500, 17 | primaryVariant = Purple700, 18 | secondary = Teal200 19 | 20 | /* Other default colors to override 21 | background = Color.White, 22 | surface = Color.White, 23 | onPrimary = Color.White, 24 | onSecondary = Color.Black, 25 | onBackground = Color.Black, 26 | onSurface = Color.Black, 27 | */ 28 | ) 29 | 30 | @Composable 31 | fun LemonadeTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { 32 | val colors = if (darkTheme) { 33 | DarkColorPalette 34 | } else { 35 | LightColorPalette 36 | } 37 | 38 | MaterialTheme( 39 | colors = colors, 40 | typography = Typography, 41 | shapes = Shapes, 42 | content = content 43 | ) 44 | } -------------------------------------------------------------------------------- /Sorting Algorithms/Merging_sort.cpp: -------------------------------------------------------------------------------- 1 | //Merging sort 2 | 3 | #include 4 | using namespace std; 5 | void merge(int *,int, int , int ); 6 | void merge_sort(int *arr, int low, int high) 7 | { 8 | int mid; 9 | if (low < high){ 10 | mid=(low+high)/2; 11 | merge_sort(arr,low,mid); 12 | merge_sort(arr,mid+1,high); 13 | merge(arr,low,high,mid); 14 | } 15 | } 16 | 17 | void merge(int *arr, int low, int high, int mid) 18 | { 19 | int i, j, k, c[50]; 20 | i = low; 21 | k = low; 22 | j = mid + 1; 23 | while (i <= mid && j <= high) { 24 | if (arr[i] < arr[j]) { 25 | c[k] = arr[i]; 26 | k++; 27 | i++; 28 | } 29 | else { 30 | c[k] = arr[j]; 31 | k++; 32 | j++; 33 | } 34 | } 35 | 36 | while (i <= mid) { 37 | c[k] = arr[i]; 38 | k++; 39 | i++; 40 | } 41 | while (j <= high) { 42 | c[k] = arr[j]; 43 | k++; 44 | j++; 45 | } 46 | for (i = low; i < k; i++) { 47 | arr[i] = c[i]; 48 | } 49 | } 50 | int main(){ 51 | int myarray[30], num; 52 | cout<<"Enter number of elements to be sorted:"; 53 | cin>>num; 54 | cout<<"Enter "<>myarray[i]; 57 | } 58 | merge_sort(myarray, 0, num-1); 59 | cout<<"Sorted array\n"; 60 | for (int i = 0; i < num; i++){ 61 | cout< 2 | using namespace std; 3 | 4 | vector searchRange(vector& nums, int target) { 5 | vector ans{-1,-1}; 6 | int n = nums.size(); 7 | int low = 0; 8 | int high = n-1; 9 | if(n == 0) return ans; 10 | 11 | while(low <= high){ 12 | int mid = low + (high - low)/2; 13 | if(nums[mid] == target){ 14 | ans[0] = mid; 15 | } 16 | if(nums[mid] >= target){ 17 | high = mid - 1; 18 | } 19 | else{ 20 | low = mid + 1; 21 | } 22 | } 23 | low = 0; 24 | high = n-1; 25 | while(low <= high){ 26 | int mid = low + (high - low)/2; 27 | if(nums[mid] == target){ 28 | ans[1] = mid; 29 | } 30 | if(nums[mid] <= target){ 31 | low = mid + 1; 32 | } 33 | else{ 34 | high = mid - 1; 35 | } 36 | } 37 | return ans; 38 | } 39 | 40 | int main(){ 41 | 42 | int n; 43 | cin>>n; 44 | vector arr(n); 45 | 46 | for(int i=0; i>arr[i]; 48 | } 49 | int tar; 50 | cin>tar; 51 | 52 | vector ans = searchRange(arr,tar); 53 | cout<<"The First and Last Position of Element in Sorted Array is: "< 2 | using namespace std; 3 | 4 | bool isPossible(vector& stalls , int n , int k , int mid) 5 | { 6 | int cowsCount = 1; 7 | int cowsDistance = stalls[0]; 8 | for(int i= 0 ; i< n ;i++) 9 | { 10 | if(stalls[i] - cowsDistance >= mid) 11 | { 12 | cowsCount++; 13 | if(cowsCount == k) 14 | { 15 | return true; 16 | } 17 | cowsDistance = stalls[i]; 18 | } 19 | 20 | } 21 | return false; 22 | } 23 | 24 | int aggresiveCows(vector &stalls , int n , int k) 25 | { 26 | sort(stalls.begin() , stalls.end()); 27 | int start = 0; 28 | int maxi = -1; 29 | for(int i=0 ; i> n >> k; 53 | vector arr; 54 | for(int i=0 ;i> x; 57 | arr.push_back(x); 58 | } 59 | int ans = aggresiveCows(arr , n , k); 60 | cout << ans; 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /C Programs/CountVowConsDigSpac.c: -------------------------------------------------------------------------------- 1 | //Program to count the total number of vowels, consonants, digits and spaces using C 2 | #include 3 | #include 4 | 5 | void main() { 6 | 7 | char Input_line[300]; 8 | 9 | int Vowel_count = 0; 10 | int Consonant_count = 0; 11 | int Digit_count = 0; 12 | int Space_count = 0; 13 | 14 | printf("Enter the sentence you want to count vowels, consonants, digits and spaces for: \n\n"); 15 | fgets(Input_line, sizeof(Input_line), stdin); 16 | 17 | 18 | for (int i = 0; Input_line[i] != '\0'; ++i) { 19 | 20 | Input_line[i] = tolower(Input_line[i]); 21 | 22 | if (Input_line[i] == 'a' || Input_line[i] == 'e' || Input_line[i] == 'i' || 23 | Input_line[i] == 'o' || Input_line[i] == 'u') 24 | { 25 | ++Vowel_count; 26 | 27 | } 28 | 29 | else if ((Input_line[i] >= 'a' && Input_line[i] <= 'z')) 30 | { 31 | ++Consonant_count; 32 | 33 | } 34 | 35 | else if (Input_line[i] >= '0' && Input_line[i] <= '9') 36 | { 37 | ++Digit_count; 38 | 39 | } 40 | 41 | else if (Input_line[i] == ' ') 42 | { 43 | ++Space_count; 44 | 45 | } 46 | } 47 | 48 | printf("Total number of vowels in the sentence: %d", Vowel_count); 49 | printf("\nTotal number of consonants in the sentence: %d", Consonant_count); 50 | printf("\nTotal number of digits in the sentence: %d", Digit_count); 51 | printf("\nTotal number of spaces in the sentence: %d", Space_count); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /C++ Programs/A_Prof_Slim.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int t; 7 | cin>>t; 8 | while(t--) 9 | { 10 | int n,g,positive=0,negative=0,swap; 11 | vector v,m; 12 | cin>>n; 13 | for(int i=0;i>g; 16 | v.push_back(g); 17 | } 18 | for(int i=0;ipositive) 29 | { 30 | swap=positive; 31 | } 32 | else 33 | { 34 | swap=negative; 35 | } 36 | // lets compare 1st and last element and this way comparing both 37 | if(n%2==0) 38 | { 39 | for(int i=0;i0 && v[n/2 -1-i]<0 && (-v[i])>=v[n/2 -1-i])) 42 | { 43 | v[i]=-v[i]; 44 | v[n/2 -1-i]=-v[n/2 -1]-i; 45 | swap--; 46 | } 47 | else if((v[i]<0 && v[n/2 -1-i]>0 && (-v[i])0 &&v[n/2 -1-i]>0) || (v[i]<0 && v[n/2 -1-i]<0)) &&v[i] 16 | 21 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /Frontend Projects/Lorem_Ipsum Generator/index.css: -------------------------------------------------------------------------------- 1 | * { 2 | padding: 0; 3 | margin: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | .section-center { 8 | width: 90vw; 9 | margin: 0 auto; 10 | max-width: 40rem; 11 | text-align: center; 12 | margin-top: 5rem; 13 | } 14 | 15 | @media screen and (min-width:992px) { 16 | .section-center { 17 | width: 95vw; 18 | } 19 | } 20 | 21 | @media screen and (min-width: 500px) { 22 | .lorem-form { 23 | display: flex; 24 | justify-content: center; 25 | align-items: center; 26 | } 27 | 28 | } 29 | 30 | .section-center h3 { 31 | font-family: sans-serif; 32 | font-size: 2rem; 33 | padding-bottom: 1rem; 34 | font-weight: 500; 35 | color: rgb(0, 110, 255); 36 | letter-spacing: 0.2rem; 37 | text-transform: capitalize; 38 | } 39 | 40 | .lorem-form { 41 | font-family: sans-serif; 42 | text-transform: capitalize; 43 | margin-bottom: 2rem; 44 | } 45 | 46 | label { 47 | font-size: 1.4rem; 48 | letter-spacing: 0.2rem; 49 | } 50 | 51 | input { 52 | padding: 4px 6px; 53 | border: none; 54 | border-radius: 8px; 55 | background-color: rgba(255, 222, 180, 0.603); 56 | width: 5rem; 57 | font-size: 1.2rem; 58 | margin: 0 0.6rem; 59 | } 60 | 61 | .btn { 62 | padding: 8px 20px; 63 | font-size: 1rem; 64 | font-weight: 400; 65 | letter-spacing: 0.12rem; 66 | background-color: coral; 67 | border: none; 68 | border-radius: 6px; 69 | cursor: pointer; 70 | margin: 1.2rem; 71 | } 72 | 73 | .btn:hover { 74 | background-color: rgb(255, 164, 131); 75 | transition: all 0.3s linear; 76 | } 77 | 78 | .result { 79 | margin-bottom: 2rem; 80 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Contribute-To-HacktoberFest 2 | 3 | ![Component_1](https://user-images.githubusercontent.com/55801439/194706267-6492d3e2-4a9d-457c-b8ba-c88f82f500d3.png) 4 | 5 | GDSC MITS is hosting an **"open-to-contribute"** repository where everyone is free to make a pull request, even if they are submitting a PR (Pull Request) for the first time or this is their 100th PR, everyone is welcome to contribute 6 | 7 | ### For details on how to contribute do checkout the [CONTRIBUTING.md](https://github.com/GDSC-MITS/Contribute-To-HacktoberFest/blob/main/CONTRIBUTING.md) 8 | 9 | --- 10 | 11 | ### Before submitting the Pull Request do make sure to provide a small description of what changes you have made 12 | Only Pull Requests with a good description will be merged to the code base 13 | ### Making issues is not required, please feel free to fork this repo and submit a pull request 14 | It becomes a more tedious process for all those who are maintaining this repo to assign everyone to their respective issues. 15 | 16 | --- 17 | 18 | ## How to Install and Configure git 19 | 20 | Do checkout these tutorials from 21 | 22 | - [GitHub](https://github.com/git-guides/install-git) 23 | - [Atlassian](https://www.atlassian.com/git) 24 | - [Git-SCM](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) 25 | 26 | | Operating System | | 27 | | ---------------- | ---------------------- | 28 | | Windows | winget install git.git | 29 | | MacOS | git --version | 30 | | Ubuntu(Debian) | sudo apt install git | 31 | | Arch | sudo pacman -S git | 32 | 33 | ```bash 34 | git config --global user.name 35 | git config --global user.email 36 | ``` 37 | -------------------------------------------------------------------------------- /C++ Programs/Detect cycle in an undirected graph.cpp: -------------------------------------------------------------------------------- 1 | public: 2 | // Function to detect cycle in an undirected graph. 3 | bool bfs( int V,vector adj[],vector& visited,int t){ 4 | queue q; 5 | vector parent(V,-1); 6 | for(int i=0;i"; 15 | if(visited[nbr] && nbr!=parent[node]) 16 | return true; //truen implies cycle 17 | else if(!visited[nbr]){ 18 | q.push(nbr); 19 | 20 | visited[nbr]=1; 21 | parent[nbr]=node; 22 | } 23 | 24 | } 25 | 26 | } 27 | 28 | return false; 29 | } 30 | 31 | bool dfs( int V,vector adj[],vector& visited,int t,int parent){ 32 | visited[t]=1; 33 | for(auto nbr: adj[t]){ 34 | if(visited[nbr] && nbr!=parent) 35 | return true; //true implies cycle 36 | else if(!visited[nbr]){ 37 | if(dfs(V,adj,visited,nbr,t)) 38 | return true;;} 39 | } 40 | return false; 41 | } 42 | 43 | 44 | bool isCycle(int V, vector adj[]) { 45 | // Code 46 | vector visited(V+1,0); 47 | bool ans=false; 48 | for(int i=0;i> "; 51 | ans=ans|| dfs(V,adj,visited,i,-1);} 52 | } 53 | return ans; 54 | } 55 | }; 56 | -------------------------------------------------------------------------------- /Frontend Projects/Creating a form: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 37 | 38 | 39 |
40 |

Contact Me

41 | 42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
52 | 53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /C Programs/Radix Sort.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int getMax(int a[], int n) { 4 | int max = a[0]; 5 | for(int i = 1; i max) 7 | max = a[i]; 8 | } 9 | return max; //maximum element from the array 10 | } 11 | 12 | void countingSort(int a[], int n, int place) // function to implement counting sort 13 | { 14 | int output[n + 1]; 15 | int count[10] = {0}; 16 | 17 | // Calculate count of elements 18 | for (int i = 0; i < n; i++) 19 | count[(a[i] / place) % 10]++; 20 | 21 | // Calculate cumulative frequency 22 | for (int i = 1; i < 10; i++) 23 | count[i] += count[i - 1]; 24 | 25 | // Place the elements in sorted order 26 | for (int i = n - 1; i >= 0; i--) { 27 | output[count[(a[i] / place) % 10] - 1] = a[i]; 28 | count[(a[i] / place) % 10]--; 29 | } 30 | 31 | for (int i = 0; i < n; i++) 32 | a[i] = output[i]; 33 | } 34 | 35 | // function to implement radix sort 36 | void radixsort(int a[], int n) { 37 | 38 | // get maximum element from array 39 | int max = getMax(a, n); 40 | 41 | // Apply counting sort to sort elements based on place value 42 | for (int place = 1; max / place > 0; place *= 10) 43 | countingSort(a, n, place); 44 | } 45 | 46 | // function to print array elements 47 | void printArray(int a[], int n) { 48 | for (int i = 0; i < n; ++i) { 49 | printf("%d ", a[i]); 50 | } 51 | printf("\n"); 52 | } 53 | 54 | int main() { 55 | int a[] = {181, 289, 390, 121, 145, 736, 514, 888, 122}; 56 | int n = sizeof(a) / sizeof(a[0]); 57 | printf("Before sorting array elements are - \n"); 58 | printArray(a,n); 59 | radixsort(a, n); 60 | printf("After applying Radix sort, the array elements are - \n"); 61 | printArray(a, n); 62 | } 63 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /Sorting Algorithms/radix_sort.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int getMax(int a[], int n) { 4 | int max = a[0]; 5 | for(int i = 1; i max) 7 | max = a[i]; 8 | } 9 | return max; //maximum element from the array 10 | } 11 | 12 | void countingSort(int a[], int n, int place) // function to implement counting sort 13 | { 14 | int output[n + 1]; 15 | int count[10] = {0}; 16 | 17 | // Calculate count of elements 18 | for (int i = 0; i < n; i++) 19 | count[(a[i] / place) % 10]++; 20 | 21 | // Calculate cumulative frequency 22 | for (int i = 1; i < 10; i++) 23 | count[i] += count[i - 1]; 24 | 25 | // Place the elements in sorted order 26 | for (int i = n - 1; i >= 0; i--) { 27 | output[count[(a[i] / place) % 10] - 1] = a[i]; 28 | count[(a[i] / place) % 10]--; 29 | } 30 | 31 | for (int i = 0; i < n; i++) 32 | a[i] = output[i]; 33 | } 34 | 35 | // function to implement radix sort 36 | void radixsort(int a[], int n) { 37 | 38 | // get maximum element from array 39 | int max = getMax(a, n); 40 | 41 | // Apply counting sort to sort elements based on place value 42 | for (int place = 1; max / place > 0; place *= 10) 43 | countingSort(a, n, place); 44 | } 45 | 46 | // function to print array elements 47 | void printArray(int a[], int n) { 48 | for (int i = 0; i < n; ++i) { 49 | printf("%d ", a[i]); 50 | } 51 | printf("\n"); 52 | } 53 | 54 | int main() { 55 | int a[] = {181, 289, 390, 121, 145, 736, 514, 888, 122}; 56 | int n = sizeof(a) / sizeof(a[0]); 57 | printf("Before sorting array elements are - \n"); 58 | printArray(a,n); 59 | radixsort(a, n); 60 | printf("After applying Radix sort, the array elements are - \n"); 61 | printArray(a, n); 62 | } 63 | -------------------------------------------------------------------------------- /Sorting Algorithms/Heap Sort.cpp: -------------------------------------------------------------------------------- 1 | //C++ program to show the implementation of Heap Sort. 2 | 3 | // C++ program for implementation of Heap Sort 4 | 5 | #include 6 | using namespace std; 7 | 8 | // To heapify a subtree rooted with node i 9 | // which is an index in arr[]. 10 | // n is size of heap 11 | void heapify(int arr[], int N, int i) 12 | { 13 | 14 | // Initialize largest as root 15 | int largest = i; 16 | 17 | // left = 2*i + 1 18 | int l = 2 * i + 1; 19 | 20 | // right = 2*i + 2 21 | int r = 2 * i + 2; 22 | 23 | // If left child is larger than root 24 | if (l < N && arr[l] > arr[largest]) 25 | largest = l; 26 | 27 | // If right child is larger than largest 28 | // so far 29 | if (r < N && arr[r] > arr[largest]) 30 | largest = r; 31 | 32 | // If largest is not root 33 | if (largest != i) { 34 | swap(arr[i], arr[largest]); 35 | 36 | // Recursively heapify the affected 37 | // sub-tree 38 | heapify(arr, N, largest); 39 | } 40 | } 41 | 42 | // Main function to do heap sort 43 | void heapSort(int arr[], int N) 44 | { 45 | 46 | // Build heap (rearrange array) 47 | for (int i = N / 2 - 1; i >= 0; i--) 48 | heapify(arr, N, i); 49 | 50 | // One by one extract an element 51 | // from heap 52 | for (int i = N - 1; i > 0; i--) { 53 | 54 | // Move current root to end 55 | swap(arr[0], arr[i]); 56 | 57 | // call max heapify on the reduced heap 58 | heapify(arr, i, 0); 59 | } 60 | } 61 | 62 | // A utility function to print array of size n 63 | void printArray(int arr[], int N) 64 | { 65 | for (int i = 0; i < N; ++i) 66 | cout << arr[i] << " "; 67 | cout << "\n"; 68 | } 69 | 70 | // Driver's code 71 | int main() 72 | { 73 | int arr[] = { 12, 11, 13, 5, 6, 7 }; 74 | int N = sizeof(arr) / sizeof(arr[0]); 75 | 76 | // Function call 77 | heapSort(arr, N); 78 | 79 | cout << "Sorted array is \n"; 80 | printArray(arr, N); 81 | } 82 | 83 | 84 | -------------------------------------------------------------------------------- /C++ Programs/n-queen.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file n-queen.cpp 3 | * @brief Solved the N-Queen problem; 4 | * 5 | * Input Format: 6 | * A single integer n, represent n x n, chessboard 7 | * 8 | * Output Format: 9 | * -1, if it is not possible to place the queens in the required order, else n x 10 | * n grid, in which 0 represents an empty square and 1 represents a Queen 11 | */ 12 | 13 | #include 14 | using namespace std; 15 | 16 | bool isSafe(int** arr, int x, int y, int n) { 17 | for (int row = 0; row < x; row++) { 18 | if (arr[row][y] == 1) { 19 | return false; 20 | } 21 | } 22 | int row = x; 23 | int col = y; 24 | 25 | while (row >= 0 && col >= 0) { 26 | if (arr[row][col] == 1) { 27 | return false; 28 | } 29 | row--; 30 | col--; 31 | } 32 | row = x; 33 | col = y; 34 | 35 | while (row >= 0 && col < n) { 36 | if (arr[row][col] == 1) { 37 | return false; 38 | } 39 | row--; 40 | col++; 41 | } 42 | return true; 43 | } 44 | 45 | bool nQueen(int** arr, int x, int n) { 46 | if (x >= n) { 47 | return true; 48 | } 49 | for (int col = 0; col < n; ++col) { 50 | if (isSafe(arr, x, col, n)) { 51 | arr[x][col] = 1; 52 | 53 | if (nQueen(arr, x + 1, n)) { 54 | return true; 55 | } 56 | 57 | arr[x][col] = 0; 58 | } 59 | } 60 | return false; 61 | } 62 | 63 | int main() { 64 | int n; 65 | cin >> n; 66 | 67 | // allocate our 2-D matrix; 68 | int** arr = new int*[n]; 69 | for (int i = 0; i < n; ++i) { 70 | arr[i] = new int[n]; 71 | for (int j = 0; j < n; ++j) { 72 | arr[i][j] = 0; 73 | } 74 | } 75 | 76 | if (!nQueen(arr, 0, n)) { 77 | cout << -1 << endl; 78 | return 1; 79 | } 80 | 81 | for (int i = 0; i < n; ++i) { 82 | for (int j = 0; j < n; ++j) { 83 | cout << arr[i][j] << " "; 84 | } 85 | cout << endl; 86 | } 87 | } -------------------------------------------------------------------------------- /C++ Programs/search_in_rotated_sorted_array.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int getPivot(vector& arr, int n) { 7 | 8 | int s = 0; 9 | int e = n-1; 10 | int mid = s + (e-s)/2; 11 | 12 | while(s= arr[0]) 15 | { 16 | s = mid+1; 17 | } 18 | else{ 19 | e = mid; 20 | } 21 | mid = s + (e-s)/2; 22 | } 23 | return s; 24 | } 25 | 26 | int binarySearch(vector& arr, int s ,int e, int key){ 27 | 28 | int start = s; 29 | int end = e; 30 | 31 | //This is done to avoid the overflowing of integer value 32 | //of start and end are added 33 | int mid = start + (end-start)/2; 34 | 35 | while(start<=end){ 36 | 37 | if(arr[mid] == key){ 38 | return mid; 39 | } 40 | 41 | else if(arr[mid] < key){ 42 | start = mid+1; 43 | } 44 | 45 | else{ 46 | end = mid-1; 47 | } 48 | 49 | mid = start + (end-start)/2; 50 | } 51 | 52 | return -1; 53 | } 54 | 55 | int search(vector nums, int target) { 56 | 57 | int n=nums.size(); 58 | int pivot = getPivot(nums,n); 59 | int ans = 0; 60 | 61 | if(target>=nums[pivot] && target<=nums[n-1]){ 62 | ans = binarySearch(nums,pivot,n-1,target); 63 | } 64 | else{ 65 | ans = binarySearch(nums,0,pivot-1,target); 66 | } 67 | return ans; 68 | 69 | } 70 | 71 | 72 | int main(){ 73 | int size,a,target; 74 | vector nums; 75 | cout<<"Enter the size of array"; 76 | cin>>size; 77 | cout<<"Enter the array: "<>a; 80 | nums.push_back(a); 81 | } 82 | cout<<"Enter the target number"; 83 | cin>>target; 84 | cout<<"The index of the target element is: "< 14 | using namespace std; 15 | 16 | // Function to get the largest element from an array 17 | int getMax(int array[], int n) { 18 | int max = array[0]; 19 | for (int i = 1; i < n; i++) 20 | if (array[i] > max) max = array[i]; 21 | return max; 22 | } 23 | 24 | // Using counting sort to sort the elements in the basis of significant places 25 | void countingSort(int array[], int size, int place) { 26 | const int max = 10; 27 | int output[size]; 28 | int count[max]; 29 | 30 | for (int i = 0; i < max; ++i) count[i] = 0; 31 | 32 | // Calculate count of elements 33 | for (int i = 0; i < size; i++) count[(array[i] / place) % 10]++; 34 | 35 | // Calculate cumulative count 36 | for (int i = 1; i < max; i++) count[i] += count[i - 1]; 37 | 38 | // Place the elements in sorted order 39 | for (int i = size - 1; i >= 0; i--) { 40 | output[count[(array[i] / place) % 10] - 1] = array[i]; 41 | count[(array[i] / place) % 10]--; 42 | } 43 | 44 | for (int i = 0; i < size; i++) array[i] = output[i]; 45 | } 46 | 47 | // Main function to implement radix sort 48 | void radixsort(int array[], int size) { 49 | // Get maximum element 50 | int max = getMax(array, size); 51 | 52 | // Apply counting sort to sort elements based on place value. 53 | for (int place = 1; max / place > 0; place *= 10) 54 | countingSort(array, size, place); 55 | } 56 | 57 | // Print an array 58 | void printArray(int array[], int size) { 59 | int i; 60 | for (i = 0; i < size; i++) cout << array[i] << " "; 61 | cout << endl; 62 | } 63 | 64 | // Driver code 65 | int main() { 66 | int n; 67 | cin >> n; 68 | int array[n]; 69 | for (int i = 0; i < n; i++) { 70 | cin >> array[i]; 71 | } 72 | 73 | radixsort(array, n); 74 | printArray(array, n); 75 | } -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'org.jetbrains.kotlin.android' 4 | } 5 | 6 | android { 7 | namespace 'com.example.lemonade' 8 | compileSdk 32 9 | 10 | defaultConfig { 11 | applicationId "com.example.lemonade" 12 | minSdk 21 13 | targetSdk 32 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | vectorDrawables { 19 | useSupportLibrary true 20 | } 21 | } 22 | 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | kotlinOptions { 34 | jvmTarget = '1.8' 35 | } 36 | buildFeatures { 37 | compose true 38 | } 39 | composeOptions { 40 | kotlinCompilerExtensionVersion '1.1.1' 41 | } 42 | packagingOptions { 43 | resources { 44 | excludes += '/META-INF/{AL2.0,LGPL2.1}' 45 | } 46 | } 47 | } 48 | 49 | dependencies { 50 | 51 | implementation 'androidx.core:core-ktx:1.7.0' 52 | implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' 53 | implementation 'androidx.activity:activity-compose:1.3.1' 54 | implementation "androidx.compose.ui:ui:$compose_ui_version" 55 | implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version" 56 | implementation 'androidx.compose.material:material:1.1.1' 57 | testImplementation 'junit:junit:4.13.2' 58 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 59 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 60 | androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version" 61 | debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version" 62 | debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version" 63 | } -------------------------------------------------------------------------------- /Java Programs/Armstrong number.java: -------------------------------------------------------------------------------- 1 | /*Lets first understand what is Armstrong number 2 | Armstrong numbers are those numbers when we do cube of every digit of the give input number(Ex 153) and then we sum up all the cubes of digits if it is equal to the 3 | given input number then it is called as Armstrong number(153) 4 | 5 | Go through examples here 6 | 153: 1^3 + 5^3 + 3^3 = 1 + 125+ 27 = 153 7 | 125: 1^3 + 2^3 + 5^3 = 1 + 8 + 125 = 134 (Not an Armstrong Number) 8 | 1634: 1^4 + 6^4 + 3^4 + 4^4 = 1 + 1296 + 81 + 256 = 1643*/ 9 | 10 | // Here we begin 11 | import java.util.Scanner; 12 | import java.lang.Math; 13 | public class ArmstsrongNumberExample2 14 | { 15 | //function to check if the number is Armstrong or not 16 | static boolean isArmstrong(int n) 17 | { 18 | int temp, digits=0, last=0, sum=0; 19 | //assigning n into a temp variable 20 | temp=n; 21 | //loop execute until the condition becomes false 22 | while(temp>0) 23 | { 24 | temp = temp/10; 25 | digits++; 26 | } 27 | temp = n; 28 | while(temp>0) 29 | { 30 | //determines the last digit from the number 31 | last = temp % 10; 32 | //calculates the power of a number up to digit times and add the resultant to the sum variable 33 | sum += (Math.pow(last, digits)); 34 | //removes the last digit 35 | temp = temp/10; 36 | } 37 | //compares the sum with n 38 | if(n==sum) 39 | //returns if sum and n are equal 40 | return true; 41 | //returns false if sum and n are not equal 42 | else return false; 43 | } 44 | 45 | // main function 46 | public static void main(String args[]) 47 | { 48 | int num; 49 | Scanner sc= new Scanner(System.in); 50 | System.out.print("Enter the number: "); 51 | //reads the limit from the user 52 | num=sc.nextInt(); 53 | if(isArmstrong(num)) 54 | { 55 | System.out.print("Armstrong "); 56 | } 57 | else 58 | { 59 | System.out.print("Not Armstrong "); 60 | } 61 | } 62 | } 63 | 64 | I hope you enjoyed this 65 | Thank you : ) 66 | -------------------------------------------------------------------------------- /Frontend Projects/FillMe/scripts/script.js: -------------------------------------------------------------------------------- 1 | const usedColors = new Map() 2 | const availableColors = [ 3 | 'red', 4 | 'green', 5 | 'blue', 6 | 'yellow', 7 | 'cyan', 8 | 'crimson', 9 | 'black', 10 | 'coral', 11 | ] 12 | 13 | const availableColorsElements = [ 14 | ...document.querySelector('.queue-table tr').children, 15 | ].reverse() 16 | 17 | const renderAvailableColors = () => { 18 | // availableColors.forEach((availableColor, availableColorIndex) => { 19 | // availableColorsElements[availableColorIndex].classList.add(availableColor) 20 | // }) 21 | 22 | availableColorsElements.forEach( 23 | (availableColorElement, availableColorIndex) => { 24 | availableColorElement.className = '' 25 | if (availableColorIndex >= availableColors.length) return 26 | availableColorElement.classList.add(availableColors[availableColorIndex]) 27 | } 28 | ) 29 | } 30 | 31 | const handleClick = e => { 32 | e.stopPropagation() 33 | 34 | const circleClasses = [...e.target.classList] 35 | 36 | const isColorInclude = circleClasses.some(circleClass => 37 | [...usedColors.keys()].includes(circleClass) 38 | ) 39 | 40 | if (isColorInclude) { 41 | const includeColor = circleClasses.find(circleColor => 42 | [...usedColors.keys()].find(color => color === circleColor) 43 | ) 44 | 45 | e.target.classList.remove(includeColor) 46 | e.target.style.borderColor = '' 47 | 48 | usedColors.delete(includeColor) 49 | availableColors.push(includeColor) 50 | renderAvailableColors() 51 | 52 | return 53 | } 54 | 55 | if (availableColors.length === 0) return 56 | e.target.classList.add(availableColors[0]) 57 | e.target.style.borderColor = 'transparent' 58 | 59 | const removedColor = availableColors.shift() 60 | usedColors.set(removedColor, removedColor) 61 | renderAvailableColors() 62 | } 63 | 64 | const render = () => { 65 | const circleContainer = document.querySelector('[data-circle-container]') 66 | 67 | const circles = 8 68 | let createdCircle = 0 69 | 70 | while (createdCircle < circles) { 71 | const circleElement = document.createElement('div') 72 | circleElement.classList.add('circle', `circle${createdCircle + 1}`) 73 | circleContainer.append(circleElement) 74 | 75 | circleElement.addEventListener('click', handleClick) 76 | createdCircle++ 77 | } 78 | 79 | renderAvailableColors() 80 | } 81 | 82 | onload = () => render() 83 | -------------------------------------------------------------------------------- /C Programs/polynomial.c: -------------------------------------------------------------------------------- 1 | #include 2 | struct poly 3 | { 4 | int expo; 5 | int coeff; 6 | } p1[10], p2[10], p3[20]; 7 | 8 | void read(struct poly a[10], int n) 9 | { 10 | int i; 11 | printf("Enter the coefficent and exponents of each terms is decreasing order of exponents \n"); 12 | for (i = 0; i < n; i++) 13 | { 14 | printf("Coefficent and exponenet of term %d \n", i + 1); 15 | scanf("%d%d", &a[i].coeff, &a[i].expo); 16 | } 17 | } 18 | 19 | void display(struct poly p3[], int k) 20 | { 21 | int i; 22 | for (i = 0; i < k; i++) 23 | { 24 | printf("%dx^%d+ ", p3[i].coeff, p3[i].expo); 25 | } 26 | printf("%dx^%d\n", p3[i].coeff, p3[i].expo); 27 | } 28 | 29 | void add(struct poly p1[10], struct poly p2[10], struct poly p3[20], int n1, int n2) 30 | { 31 | int i = 0, j = 0, k = 0; 32 | while (i < n1 && j < n2) 33 | { 34 | if (p1[i].expo == p2[j].expo) 35 | { 36 | p3[k].coeff = p1[i].coeff + p2[j].coeff; 37 | p3[k].expo = p1[i].expo; 38 | i++; 39 | j++; 40 | k++; 41 | } 42 | else if (p1[i].expo > p2[j].expo) 43 | { 44 | p3[k].coeff = p1[i].coeff; 45 | p3[k].expo = p1[i].expo; 46 | i++; 47 | k++; 48 | } 49 | else 50 | { 51 | p3[k].coeff = p1[j].coeff; 52 | p3[k].expo = p1[j].expo; 53 | j++; 54 | k++; 55 | } 56 | } 57 | while (i < n1) 58 | { 59 | p3[k].coeff = p1[i].coeff; 60 | p3[k].expo = p1[i].expo; 61 | i++; 62 | k++; 63 | } 64 | while (j < n2) 65 | { 66 | p3[k].coeff = p1[j].coeff; 67 | p3[k].expo = p1[j].expo; 68 | j++; 69 | k++; 70 | } 71 | printf("The sum of the two polynomials is \n p3= "); 72 | display(p3, k); 73 | } 74 | 75 | void main() 76 | { 77 | int n1, n2; 78 | printf("Enter the number of terms in first polynomial: "); 79 | scanf("%d", &n1); 80 | read(p1, n1); 81 | printf("First Polynomial is \n p1 = "); 82 | display(p1, n1); 83 | printf("Enter the number of terms of second polynomial: "); 84 | scanf("%d", &n2); 85 | read(p2, n2); 86 | printf("Second Polynomial is \n p2 = "); 87 | display(p2, n2); 88 | add(p1, p2, p3, n1, n2); 89 | } 90 | -------------------------------------------------------------------------------- /Frontend Projects/tip calculator/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Tip Calculator 6 | 7 | 8 | 9 | 10 |
11 |
12 |

Tip Calculator

13 |
14 |
15 |
16 | How much was your bill? 17 |
18 |
19 | Rs: 20 |
21 |
22 | How was your service? 23 |
24 |
25 | 31 |
32 |
33 | How many people are sharing the bill? 34 |
35 |
36 | 37 |
38 |
39 | 40 |
41 |
42 |
43 | 59 | 60 | -------------------------------------------------------------------------------- /Frontend Projects/Split Screen/style/style.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;800&display=swap'); 2 | 3 | :root { 4 | --hover-width: 99%; 5 | --other-width: 1%; 6 | --font-family: "Work Sans", sans-serif 7 | } 8 | 9 | html, 10 | body { 11 | padding: 0; 12 | margin: 0; 13 | font-family: var(--font-family); 14 | width: 100%; 15 | height: 100%; 16 | overflow-x: hidden; 17 | text-decoration: none; 18 | box-sizing: border-box; 19 | } 20 | 21 | h2 { 22 | text-transform: uppercase; 23 | font-size: 4rem; 24 | font-weight: normal; 25 | color: #fff; 26 | position: absolute; 27 | left: 50%; 28 | top: 50%; 29 | transform: translate(-50%, -50%); 30 | white-space: nowrap; 31 | z-index: 1; 32 | } 33 | h2 strong { 34 | font-weight: 800; 35 | } 36 | 37 | .container { 38 | background: url("../static/img/bg-bw.jpg") no-repeat; 39 | background-attachment: fixed; 40 | background-position: center; 41 | background-size: cover; 42 | position: relative; 43 | width: 100%; 44 | height: 100%; 45 | } 46 | 47 | .split { 48 | position: absolute; 49 | width: 50%; 50 | height: 100%; 51 | overflow: hidden; 52 | } 53 | 54 | .split.left:before { 55 | content: ""; 56 | position: absolute; 57 | background: url("../static/img/bg-colored.jpg") no-repeat; 58 | background-attachment: fixed; 59 | background-position: center; 60 | background-size: cover; 61 | top: 0; 62 | right: 0; 63 | bottom: 0; 64 | left: 0; 65 | } 66 | 67 | .split.right { 68 | right: 0; 69 | } 70 | 71 | .split.left, 72 | .split.right { 73 | transition: 1000ms all ease-in-out; 74 | } 75 | 76 | .split.left *, 77 | .split.right * { 78 | opacity: 0; 79 | transition: 1000ms all ease-out; 80 | } 81 | 82 | .hover-left .left { 83 | width: var(--hover-width); 84 | } 85 | 86 | .hover-left .left * { 87 | opacity: 1; 88 | } 89 | .hover-left .right { 90 | width: var(--other-width); 91 | } 92 | 93 | .hover-right .right { 94 | width: var(--hover-width); 95 | } 96 | 97 | .hover-right .right * { 98 | opacity: 1; 99 | } 100 | 101 | .hover-right .left { 102 | width: var(--other-width); 103 | } 104 | 105 | @media (max-width: 800px) { 106 | h1 { 107 | font-size: 2rem; 108 | } 109 | } 110 | 111 | .credit { 112 | position: absolute; 113 | bottom: 20px; 114 | right: 20px; 115 | background: rgba(255, 255, 255, 0.4); 116 | border: 2px solid rgba(0, 0, 0, 0.4); 117 | border-radius: 5px; 118 | color: black; 119 | padding: 0.5rem 1rem; 120 | } -------------------------------------------------------------------------------- /Frontend Projects/FillMe/styles/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | body { 8 | min-height: 100vh; 9 | display: grid; 10 | justify-items: center; 11 | align-content: center; 12 | position: relative; 13 | background-color: rgb(51, 53, 54); 14 | padding-block: 1.5em; 15 | } 16 | 17 | h1 { 18 | text-align: center; 19 | color: #ddd; 20 | } 21 | 22 | h1 + p { 23 | margin-bottom: 1.5em; 24 | color: #aaa; 25 | } 26 | 27 | .circle-container { 28 | display: flex; 29 | gap: 0.5em; 30 | position: relative; 31 | width: 60vmin; 32 | height: 60vmin; 33 | min-width: 10rem; 34 | min-height: 10rem; 35 | } 36 | 37 | .circle { 38 | border: 0.2em solid #bbb; 39 | height: 30%; 40 | width: 30%; 41 | cursor: pointer; 42 | position: absolute; 43 | transition: background-color 300ms ease-in-out, border 300ms ease-in-out; 44 | } 45 | 46 | .circle:hover { 47 | border-color: gray; 48 | } 49 | 50 | .red { 51 | background-color: red; 52 | } 53 | .yellow { 54 | background-color: yellow; 55 | } 56 | .blue { 57 | background-color: blue; 58 | } 59 | .green { 60 | background-color: green; 61 | } 62 | 63 | .cyan { 64 | background-color: cyan; 65 | } 66 | .crimson { 67 | background-color: crimson; 68 | } 69 | 70 | .black { 71 | background-color: black; 72 | } 73 | 74 | .coral { 75 | background-color: coral; 76 | } 77 | 78 | .circle1 { 79 | top: 0; 80 | translate: -50% 0; 81 | left: 50%; 82 | } 83 | 84 | .circle2 { 85 | top: 0; 86 | right: 0; 87 | border-radius: 0 50% 0 0; 88 | } 89 | 90 | .circle3 { 91 | top: 50%; 92 | right: 0; 93 | translate: 0 -50%; 94 | } 95 | 96 | .circle4 { 97 | bottom: 0; 98 | right: 0; 99 | border-radius: 0 0 50% 0; 100 | } 101 | 102 | .circle5 { 103 | bottom: 0; 104 | translate: -50% 0; 105 | left: 50%; 106 | } 107 | 108 | .circle6 { 109 | bottom: 0; 110 | left: 0; 111 | border-radius: 0 0 0 50%; 112 | } 113 | 114 | .circle7 { 115 | top: 50%; 116 | left: 0; 117 | translate: 0 -50%; 118 | } 119 | 120 | .circle8 { 121 | top: 0; 122 | left: 0; 123 | border-radius: 50% 0 0 0; 124 | } 125 | 126 | .queue-table { 127 | margin-top: 1.5em; 128 | border-collapse: collapse; 129 | border: 0.15em solid #bbb; 130 | } 131 | 132 | .queue-table td { 133 | width: 2rem; 134 | height: 2rem; 135 | border: 0.15em solid #bbb; 136 | } 137 | 138 | .queue-table caption { 139 | font-weight: bold; 140 | font-size: 0.85rem; 141 | color: #ddd; 142 | } 143 | 144 | .queue-table td { 145 | transition: background-color 300ms ease-in-out; 146 | } 147 | -------------------------------------------------------------------------------- /Rust Programs/ArrayOperations.rs: -------------------------------------------------------------------------------- 1 | use text_io::read; 2 | 3 | static mut ARRAY: [i32; 100] = [0; 100]; 4 | fn main() { 5 | println!("Enter the size of the array:"); 6 | let mut n: i32 = read!(); 7 | println!("Enter the elements of the array"); 8 | unsafe { 9 | for i in 0..n { 10 | ARRAY[i as usize] = read!(); 11 | } 12 | } 13 | while 10 < 20 { 14 | println!("-------------------"); 15 | println!("Menu Driven Program"); 16 | println!("-------------------"); 17 | println!("1. Add an element to an array"); 18 | println!("2. Delete an element from an array"); 19 | println!("3. Display the sum of all elements in the array"); 20 | println!("4. Display all elements in an array"); 21 | println!("Input the choice"); 22 | println!("-----------------"); 23 | let ch: i32 = read!(); 24 | println!("-----------------"); 25 | if ch == 1 { 26 | add(&mut n); 27 | } else if ch == 2 { 28 | delete(&mut n); 29 | } else if ch == 3 { 30 | sum(n); 31 | } else if ch == 4 { 32 | display(n); 33 | } else { 34 | println!("Program Closed Succesfully"); 35 | break; 36 | } 37 | } 38 | } 39 | fn add(n: &mut i32) { 40 | println!("Enter the Index to which the element is to be added"); 41 | let indx: usize = read!(); 42 | unsafe { 43 | for j in 0..*n as usize { 44 | let i = *n as usize - j; 45 | ARRAY[i] = ARRAY[i - 1]; 46 | if i as usize == indx { 47 | ARRAY[i] = ARRAY[i - 1]; 48 | print!("Enter Value:"); 49 | let value = read!(); 50 | ARRAY[indx] = value; 51 | break; 52 | } 53 | } 54 | } 55 | println!("{} Updated to {}", *n, *n + 1); 56 | *n += 1; 57 | } 58 | fn delete(n: &mut i32) { 59 | println!("Enter the Index to which the element is to be deleted"); 60 | let indx: usize = read!(); 61 | for i in indx..*n as usize { 62 | unsafe { 63 | ARRAY[i] = ARRAY[i + 1]; 64 | } 65 | } 66 | println!("{} Updated to {}", *n, *n + 1); 67 | *n -= 1; 68 | } 69 | fn sum(n: i32) { 70 | let mut sum = 0; 71 | for i in 0..n as usize { 72 | unsafe { 73 | sum += ARRAY[i]; 74 | } 75 | } 76 | println!("Sum of elements of the array is {sum}"); 77 | } 78 | fn display(n: i32) { 79 | for i in 0..n as usize { 80 | unsafe { 81 | println!("{}", ARRAY[i]); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute in this repo. 2 | 3 | ### Contributing to open-source is easy. 4 | 5 | ### Before submiting the PR do make sure to provide a small description on what changes you have made 6 | 7 | 1. ### Star and Fork the Repo 8 | 9 | - Feel free to Star:star: the repo, if you like it. 10 | star the repo 11 | 12 | - Click on `fork` button in the right corner.It will create a copy of repository in your account. 13 | fork the repo 14 | 15 | - Creating the copy of repository 16 | forking the repo 17 | 18 | - Check here [How to fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) 19 | 20 | 21 | 2. ### Clone the Repo 22 | 23 | You can **clone** your repository in your local pc with use of **[Github_Desktop](https://desktop.github.com/)** application or for your [Terminal/bash](https://git-scm.com/downloads). 24 | 25 | For **Terminal** - 26 | 27 | ```bash 28 | git clone 29 | ``` 30 | 31 | - [Cloning the Repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository) 32 | 33 | 34 | 3. ### Upload your Code or Change 35 | 36 | Make what change you want to make in Repo. It can be spelling mistake, code correction or anything. 37 | 38 | You can also upload your program to respective folder. It can be anything "Hello world program", "Rock Paper Scissors",etc. 39 | 40 | `All Repository are open for contributions.` 41 | 42 | 4. ### Push it and Make a PR 43 | 44 | - Go to the `Pull requests` section and Click the `New pull request` button. 45 | Create New PR 46 | 47 | - Click the `Create pull request` to compare your copy of the repo with the real one. 48 | Compare PR 49 | 50 | - Write a `Title`, `Leave a comment` and click `Create New PR`button to merge the PR. 51 | merge PR 52 | And, that's it! 53 | 54 | New to Open Source? Don't know how to [`Create a Pull Request`](https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github)? read this documentation. 55 | -------------------------------------------------------------------------------- /Frontend Projects/Temperature-converter/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Temperature Converter in Javascript 5 | 8 | 9 | 99 | 100 | 101 |
102 |

Temperature Converter

103 | 104 | 105 |
106 | 107 | 108 |
109 | 110 | 111 |
112 | 113 | 114 | 115 | 116 |
117 | 118 | 119 | -------------------------------------------------------------------------------- /Java Programs/Merging to Array in sorted order: -------------------------------------------------------------------------------- 1 | /* Here our main focus is to learn two pointer approach ,How we can solve it using two pointer approach for merging two sorted arrays. 2 | You have been given two sorted arrays/lists(ARR1 and ARR2) of size N and M respectively, merge them into a third array/list such that the third array is also sorted. 3 | 4 | Input format : 5 | The first line contains an Integer 't' which denotes the number of test cases or queries to be run. Then the test cases follow. 6 | First line of each test case or query contains an integer 'N' representing the size of the first array/list. 7 | Second line contains 'N' single space separated integers representing the elements of the first array/list. 8 | Third line contains an integer 'M' representing the size of the second array/list. 9 | Fourth line contains 'M' single space separated integers representing the elements of the second array/list. 10 | 11 | Input: 12 | 1 13 | 5 14 | 1 3 4 7 11 15 | 4 16 | 2 4 6 13 17 | 18 | Output: 19 | 1 2 3 4 4 6 7 11 13 20 | 21 | Note : Here merge function is given to us ,assumed that we will be given array as input ,and we have to complete that ,I hope everyone can create the main function. 22 | 23 | */ 24 | // This is the snippet 25 | // Make sure you do tracing on paper. 26 | public static int[] merge(int arr1[], int arr2[]) 27 | { 28 | int m = arr1.length; 29 | int n = arr2.length,i=0,j=0,k=0; 30 | int ans[] = new int[m+n]; 31 | /*Here with pointer i and j we are camparing elements and whichever the element smallest is copied to third array(ans) and then 32 | respective pointer and the ans array indexing is incremented*/ 33 | while((i 2 | 3 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /C++ Programs/A_Glory_Addicts.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int t; 8 | cin >> t; 9 | while (t--) 10 | { 11 | int n,i=0; 12 | cin >> n; 13 | vector skill_type; 14 | for (int i = 0; i < n; ++i) 15 | { 16 | cin>>i; 17 | skill_type.push_back(i); 18 | } 19 | vector damage; 20 | for (int i = 0; i < n; ++i) 21 | { 22 | cin>>i; 23 | damage.push_back(i); 24 | } 25 | vector indices_0; 26 | 27 | vector indices_1; 28 | for (int i = 0; i < n; ++i) 29 | { 30 | if(damage[i]==0) 31 | { 32 | indices_0.push_back(i); 33 | 34 | } 35 | else 36 | { 37 | indices_1.push_back(i); 38 | } 39 | } 40 | vector damage_0; 41 | 42 | vector damage_1; 43 | for (int i = 0; i < indices_0.size(); ++i) 44 | { 45 | damage_0.push_back(damage[i]); 46 | } 47 | for (int i = 0; i < indices_1.size(); ++i) 48 | { 49 | damage_1.push_back(damage[i]); 50 | } 51 | sort(damage_0.begin(), damage_0.end()); 52 | sort(damage_1.begin(), damage_1.end()); 53 | reverse(damage_0.begin(), damage_0.end()); 54 | reverse(damage_1.begin() , damage_1.end()); 55 | int no_of_0=indices_0.size(); 56 | int no_of_1=indices_1.size(); 57 | 58 | // making three cases 59 | if(no_of_0==no_of_1) 60 | { 61 | 62 | if (damage_0[no_of_0-1]<=damage_1[no_of_1-1]) 63 | { 64 | int t=damage_0[no_of_0-1]; 65 | damage_0.pop_back(); 66 | int sum1= accumulate(damage_1.begin(), damage_1.end(), 0); 67 | int sum2= accumulate(damage_0.begin(), damage_0.end(), 0); 68 | int result=sum1*2 + sum2*2 + t; 69 | cout< 2 | void read(int a[10][10], int r[2]); 3 | void triplet_conversion(int a[10][10], int s[10][3], int m, int n); 4 | void addition(int s1[10][3], int s2[10][3], int c[10][3]); 5 | void display(int a[10][3]); 6 | void read(int a[10][10], int r[2]) 7 | { 8 | int m, n, i, j; 9 | printf("Enter the number of rows and columns of the matrix: \n"); 10 | scanf("%d%d", &m, &n); 11 | r[0] = m; 12 | r[1] = n; 13 | printf("Enter the matrix elements:\n"); 14 | for (i = 0; i < m; i++) 15 | { 16 | for (j = 0; j < n; j++) 17 | { 18 | scanf("%d", &a[i][j]); 19 | } 20 | } 21 | } 22 | void triplet_conversion(int a[10][10], int s[10][3], int m, int n) 23 | { 24 | int i, j, k = 1; 25 | for (i = 0; i < m; i++) 26 | { 27 | for (j = 0; j < n; j++) 28 | { 29 | if (a[i][j] != 0) 30 | { 31 | s[k][0] = i; 32 | s[k][1] = j; 33 | s[k][2] = a[i][j]; 34 | k++; 35 | } 36 | } 37 | } 38 | s[0][0] = m; 39 | s[0][1] = n; 40 | s[0][2] = k - 1; 41 | } 42 | void addition(int s1[10][3], int s2[10][3], int c[10][3]) 43 | { 44 | int a = s1[0][2], b = s2[0][2]; 45 | int i = 1, j = 1, k = 1; 46 | while (i <= a && j <= b) 47 | { 48 | if (s1[i][0] < s2[j][0]) 49 | { 50 | c[k][0] = s1[i][0]; 51 | c[k][1] = s1[i][1]; 52 | c[k][2] = s1[i][2]; 53 | i++; 54 | k++; 55 | } 56 | else if (s1[i][0] > s2[j][0]) 57 | { 58 | c[k][0] = s2[j][0]; 59 | c[k][1] = s2[j][1]; 60 | c[k][2] = s2[j][2]; 61 | j++; 62 | k++; 63 | } 64 | else if (s1[i][1] < s2[j][1]) 65 | { 66 | c[k][0] = s1[i][0]; 67 | c[k][1] = s1[i][1]; 68 | c[k][2] = s1[i][2]; 69 | i++; 70 | k++; 71 | } 72 | else if (s1[i][1] > s2[j][1]) 73 | { 74 | c[k][0] = s2[j][0]; 75 | c[k][1] = s2[j][1]; 76 | c[k][2] = s2[j][2]; 77 | j++; 78 | k++; 79 | } 80 | else 81 | { 82 | c[k][0] = s1[i][0]; 83 | c[k][1] = s1[i][1]; 84 | c[k][2] = s1[i][2] + s2[j][2]; 85 | i++; 86 | j++; 87 | k++; 88 | } 89 | } 90 | while (i <= a) 91 | { 92 | c[k][0] = s1[i][0]; 93 | c[k][1] = s1[i][1]; 94 | c[k][2] = s1[i][2]; 95 | i++; 96 | k++; 97 | } 98 | while (j <= b) 99 | { 100 | c[k][0] = s2[j][0]; 101 | c[k][1] = s2[j][1]; 102 | c[k][2] = s2[j][2]; 103 | j++; 104 | k++; 105 | } 106 | c[0][0] = s1[0][0]; 107 | c[0][1] = s1[0][1]; 108 | c[0][2] = k - 1; 109 | } 110 | void display(int a[10][3]) 111 | { 112 | int m = a[0][2], i, j; 113 | for (i = 0; i < m + 1; i++) 114 | { 115 | for (j = 0; j < 3; j++) 116 | { 117 | printf("%d\t", a[i][j]); 118 | } 119 | printf("\n"); 120 | } 121 | } 122 | void main() 123 | { 124 | int a[10][10], b[10][10], c[10][3], s1[10][3], s2[10][3], r1[2], r2[2]; 125 | printf("First Matrix \n"); 126 | read(a, r1); 127 | printf("Second Matrix \n"); 128 | read(b, r2); 129 | if (r1[0] == r2[0] && r1[1] == r2[1]) 130 | { 131 | triplet_conversion(a, s1, r1[0], r1[1]); 132 | triplet_conversion(b, s2, r2[0], r2[1]); 133 | printf("Triplet forms of first matrix is: \n"); 134 | display(s1); 135 | printf("Triplet forms of second matrix is: \n"); 136 | display(s2); 137 | addition(s1, s2, c); 138 | printf("The sum of the two sparse matrices is: \n"); 139 | display(c); 140 | } 141 | } -------------------------------------------------------------------------------- /Sorting Algorithms/selection-insertion.c: -------------------------------------------------------------------------------- 1 | // The following program does a comparison between Selection and Insertion sort in terms of time complexity. 2 | // It generates 5 files with 100,000 random numbers in them and then sorts these number according to the sorting algorithm used. 3 | 4 | #include 5 | #include 6 | #include 7 | #define LIMIT 100000 8 | 9 | //creating files 10 | char filename[5][15]={"numbers_1.dat","numbers_2.dat","numbers_3.dat","numbers_4.dat","numbers_5.dat"}; 11 | 12 | void selection_sort(int a[],int n) 13 | { 14 | int i, j, min, temp; 15 | //one by one traversing each number in array 16 | for (i = 0; i < n-1; i++) 17 | { 18 | // Finding minimum number 19 | min = i; 20 | for (j = i+1; j < n; j++) 21 | { 22 | if (a[j] < a[min]) 23 | { 24 | min = j; 25 | } 26 | } 27 | //swap if minimum number is found 28 | if(min!=i) 29 | { 30 | temp=a[min]; 31 | a[min]=a[i]; 32 | a[i]=temp; 33 | } 34 | } 35 | } 36 | 37 | void insertion_sort(int arr[], int n) 38 | { 39 | int i, key, j; 40 | //to go through each element from arr[1] to arr[n] 41 | for (i = 1; i < n; i++) 42 | { 43 | key = arr[i]; //storing the element as temp 44 | j = i - 1; 45 | 46 | while (j >= 0 && arr[j] > key)//to compare till arr[0] and value is greater than temp 47 | { 48 | arr[j + 1] = arr[j]; 49 | j = j - 1; 50 | } 51 | arr[j + 1] = key; 52 | } 53 | } 54 | 55 | int main() 56 | { 57 | struct timeval stop, start; 58 | int i,temp,a; 59 | int random_number; 60 | int arr[LIMIT]; 61 | FILE *file; 62 | float diff_sel[5]; 63 | float diff_ins[5]; 64 | 65 | //for loop for generating numbers, selection sort and insertion sort for 5 files 66 | for (a=0;a<5;a++) 67 | { 68 | //to generate random numbers- file is opened, srand is used as seed with reference to time(0) 69 | //random numbers are generated using rand function 70 | file=fopen(filename[a],"w"); 71 | srand((unsigned)time(0)); 72 | i=0; 73 | do 74 | { 75 | random_number = (int) (rand()%1000) ; 76 | fprintf(file, "%d\n", random_number); 77 | i++; 78 | }while (i heap; 6 | 7 | public PriorityQueue() { // a constructor 8 | heap = new ArrayList<>(); 9 | } 10 | 11 | boolean isEmpty() { 12 | return heap.size() == 0; // .size is a function on ArrayList to check the size , here heap is implemented 13 | // as an Array 14 | } 15 | 16 | int size() { 17 | return heap.size(); 18 | } 19 | 20 | int getMin() { // we are implementing minHeap by storing as Array , so minimum element will be 21 | // at 0 22 | if (isEmpty()) { 23 | // throw Exception 24 | } 25 | return heap.get(0); 26 | } 27 | 28 | void insert(int element) { 29 | heap.add(element); // puts element at the last of the Array. 30 | // now after insertion we do upheapify to check the heap property, the root has 31 | // to be less priority than both left child and right child 32 | int childIndex = heap.size() - 1; 33 | int parentIndex = (childIndex - 1) / 2; 34 | while (childIndex > 0) { 35 | // now if the child is greater than the parent then we swap 36 | if (heap.get(childIndex) < heap.get(parentIndex)) { 37 | // swap them 38 | int temp = heap.get(childIndex); 39 | heap.set(childIndex, heap.get(parentIndex)); 40 | heap.set(parentIndex, temp); 41 | // reset the indexes 42 | childIndex = parentIndex; 43 | parentIndex = (childIndex - 1) / 2; 44 | } else { 45 | return; 46 | } 47 | } 48 | } 49 | 50 | // delete function 51 | int removeMin() { // returns the deleted element 52 | if (isEmpty()) { 53 | // throw Exception 54 | } 55 | int temp = heap.get(0); // store first/min element in the heap 56 | heap.set(0, heap.get(heap.size() - 1)); // take an element from last and put it at first index of Heap. 57 | // remove the last element from the heap 58 | heap.remove(heap.size() - 1); 59 | // now lets start the heapify down process the process to check whether minHeap 60 | // properties are satisfied 61 | int index = 0; 62 | int minIndex = index; 63 | int leftChildIndex = // (2*i+1) 64 | 1; 65 | int rightChildIndex = // (2*i+2) 66 | 2; 67 | while (leftChildIndex < heap.size()) 68 | { 69 | if (heap.get(leftChildIndex) < heap.get(minIndex)) { 70 | minIndex = leftChildIndex; 71 | } 72 | if (rightChildIndex < heap.size() && heap.get(rightChildIndex) < heap.get(minIndex)) { 73 | minIndex = rightChildIndex; 74 | } 75 | //if heap is already ok, then minIndex will not change 76 | if(minIndex==index){ 77 | break; 78 | }else{ 79 | int temp1 = heap.get(index); 80 | heap.set(index, heap.get(minIndex)); 81 | heap.set(minIndex, temp1); 82 | index = minIndex; 83 | leftChildIndex = (2*index+1); 84 | rightChildIndex = (2*index +2); 85 | 86 | } 87 | } 88 | 89 | return temp; 90 | } 91 | 92 | //driver code to check the functions 93 | public static void main(String[] args) { 94 | PriorityQueue pq = new PriorityQueue(); 95 | int arr[] = {5,1,9,2,0}; 96 | for(int i=0;i {2, 6}, median = 4 22 | S = {6, 2, 1} -> {1, 2, 6}, median = 2 23 | S = {6, 2, 1, 3} -> {1, 2, 3, 6}, median = 2 24 | S = {6, 2, 1, 3, 7} -> {1, 2, 3, 6, 7}, median = 3 25 | S = {6, 2, 1, 3, 7, 5} -> {1, 2, 3, 5, 6, 7}, median = 4 26 | Sample Input 2 : 27 | 5 28 | 5 4 3 2 1 29 | Sample Output 2 : 30 | 5 4 4 3 3*/ 31 | 32 | //Solution to this 33 | import java.util.ArrayList; 34 | import java.util.Collections; 35 | import java.util.PriorityQueue; 36 | 37 | public class Running_median { 38 | 39 | public static void findMedian(int arr[]) 40 | { 41 | PriorityQueueminHeap =new PriorityQueue(); 42 | PriorityQueuemaxHeap =new PriorityQueue(Collections.reverseOrder()); 43 | ArrayList output = new ArrayList(); 44 | for(int i =0;i1) 55 | { 56 | minHeap.add(maxHeap.poll()); 57 | int median = (maxHeap.peek()+minHeap.peek())/2; 58 | //output.add(median); 59 | arr[i] = median; 60 | } 61 | else if(maxHeap.size() == minHeap.size()) 62 | { 63 | int median = (maxHeap.peek()+minHeap.peek())/2; 64 | // output.add(median); 65 | arr[i] = median; 66 | } 67 | else if((maxHeap.size()-minHeap.size())== 1) 68 | { 69 | int median = maxHeap.peek(); 70 | //output.add(median); 71 | arr[i] = median; 72 | } 73 | } 74 | else if(arr[i]>maxHeap.peek()) 75 | { 76 | minHeap.add(arr[i]); 77 | if((minHeap.size()-maxHeap.size())>1) 78 | { 79 | maxHeap.add(minHeap.poll()); 80 | int median = (maxHeap.peek()+minHeap.peek())/2; 81 | //output.add(median); 82 | arr[i] = median; 83 | } 84 | else if(maxHeap.size() == minHeap.size()) 85 | { 86 | int median = (maxHeap.peek()+minHeap.peek())/2; 87 | //output.add(median); 88 | arr[i] = median; 89 | } 90 | else if((minHeap.size()-maxHeap.size())== 1) 91 | { 92 | int median = minHeap.peek(); 93 | //output.add(median); 94 | arr[i] = median; 95 | } 96 | } 97 | 98 | } 99 | // for(int i =0;i Rightside(BinaryTreeNode root) 19 | { 20 | ArrayList rStore = new ArrayList(); 21 | if(root == null) 22 | return rStore; 23 | rStore.add(root.data); // root data first 24 | if(root.right != null) { 25 | BinaryTreeNodenode = root.right; 26 | if(node.right != null || node.left != null) 27 | { 28 | rStore.add(node.data); 29 | } 30 | } 31 | Rightside(root.right); 32 | return rStore; 33 | } 34 | 35 | // This function is store all the leaf nodes of peripheral nodes from Right to left direction 36 | public static ArrayList leafnode(BinaryTreeNode root) 37 | { 38 | ArrayList leaf = new ArrayList(); 39 | if(root == null) 40 | return leaf; 41 | 42 | if(root.right == null && root.left == null) 43 | { 44 | leaf.add(root.data); 45 | } 46 | ArrayList r = leafnode(root.right); 47 | if(!r.isEmpty()) 48 | { 49 | for(int i =0;il = leafnode(root.left); 55 | if(!l.isEmpty()) 56 | { 57 | for(int i =0;i leftside(BinaryTreeNode root) // ArrayList which i will get i need to reverse 69 | { 70 | ArrayList lStore = new ArrayList(); 71 | if(root == null) 72 | return lStore; 73 | if(root.left != null) { 74 | BinaryTreeNodenode = root.left; 75 | if(node.right != null || node.left != null) 76 | { 77 | lStore.add(node.data); 78 | } 79 | } 80 | leftside(root.left); 81 | return lStore; 82 | } 83 | 84 | //Take input levelwise 85 | public static BinaryTreeNode takeinputlevelwise() 86 | { 87 | Scanner s = new Scanner(System.in); 88 | System.out.println("Enter the root data"); 89 | 90 | int rootdata = s.nextInt(); 91 | if(rootdata == -1) 92 | { 93 | return null; 94 | } 95 | BinaryTreeNode root = new BinaryTreeNode<>(rootdata); 96 | Queue>q = new LinkedList<>(); 97 | q.add(root); 98 | 99 | while(!q.isEmpty()) 100 | { 101 | BinaryTreeNode front = q.poll(); 102 | System.out.println("Enter left child of root"+" "+front.data); 103 | int leftdata = s.nextInt(); 104 | if(leftdata != -1) 105 | { 106 | BinaryTreeNode node1 = new BinaryTreeNode<>(leftdata); 107 | q.add(node1); 108 | front.left = node1; 109 | } 110 | // for right child 111 | System.out.println("Enter right child of root"+" "+front.data); 112 | int rightdata = s.nextInt(); 113 | if(rightdata != -1) 114 | { 115 | BinaryTreeNode node2 = new BinaryTreeNode<>(rightdata); 116 | q.add(node2); 117 | front.right =node2; 118 | } 119 | } 120 | return root; 121 | } 122 | 123 | 124 | public static void main(String[] args) 125 | { 126 | BinaryTreeNode root = takeinputlevelwise(); 127 | ArrayList ans1 = Rightside(root); 128 | ArrayListans2 =leafnode(root); 129 | ArrayListans3 =leftside(root); 130 | 131 | // Printing all the right boundary node 132 | for(int i =0; i=0;i--) 144 | { 145 | System.out.print(ans3.get(i)+" "); 146 | } 147 | } 148 | 149 | } 150 | 151 | 152 | Hope you liked it: ) 153 | Happy coding!! 154 | -------------------------------------------------------------------------------- /Frontend Projects/Lorem_Ipsum Generator/index.js: -------------------------------------------------------------------------------- 1 | const text = [ 2 | `Jelly sweet roll jelly beans biscuit pie macaroon chocolate donut. Carrot cake caramels pie sweet apple pie tiramisu carrot cake. Marzipan marshmallow croissant tootsie roll lollipop. Cupcake lemon drops bear claw gummies. Jelly bear claw gummi bears lollipop cotton candy gummi bears chocolate bar cake cookie. Cupcake muffin danish muffin cookie gummies. Jelly beans tiramisu pudding. Toffee soufflé chocolate cake pastry brownie. Oat cake halvah sweet roll cotton candy croissant lollipop. Macaroon tiramisu chocolate bar candy candy carrot cake jelly sweet. Gummies croissant macaroon dessert. Chocolate cake dragée pie.`, 3 | `Next level tbh everyday carry, blog copper mug forage kitsch roof party pickled hammock kale chips tofu. Etsy shoreditch 8-bit microdosing, XOXO viral butcher banh mi humblebrag listicle woke bicycle rights brunch before they sold out ramps. Twee shabby chic taiyaki flannel, enamel pin venmo vape four loko. Hexagon kale chips typewriter kitsch 8-bit organic plaid small batch keffiyeh ethical banh mi narwhal echo park cronut.`, 4 | `Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.`, 5 | `Cat gets stuck in tree firefighters try to get cat down firefighters get stuck in tree cat eats firefighters' slippers kitty power ignore the squirrels, you'll never catch them anyway for what a cat-ass-trophy! or purr as loud as possible, be the most annoying cat that you can, and, knock everything off the table. Pretend you want to go out but then don't bite off human's toes, yet disappear for four days and return home with an expensive injury; bite the vet so catch eat throw up catch eat throw up bad birds. `, 6 | `This opera's as lousy as it is brilliant! Your lyrics lack subtlety. You can't just have your characters announce how they feel. That makes me feel angry! Anyhoo, your net-suits will allow you to experience Fry's worm infested bowels as if you were actually wriggling through them. 7 | I just told you! You've killed me! Fry! Quit doing the right thing, you jerk! Michelle, I don't regret this, but I both rue and lament it. Morbo can't understand his teleprompter because he forgot how you say that letter that's shaped like a man wearing a hat.`, 8 | `Airedale hard cheese mozzarella. Pecorino melted cheese port-salut emmental babybel cheese and wine melted cheese manchego. Everyone loves blue castello everyone loves fromage cheese slices airedale cheddar cream cheese. Bavarian bergkase who moved my cheese halloumi port-salut gouda jarlsberg ricotta rubber cheese. Stinking bishop smelly cheese brie.`, 9 | `Salvia glossier subway tile, leggings mustache YOLO semiotics chia. Pitchfork tbh af blog church-key meggings vaporware PBR&B master cleanse post-ironic man bun pabst mustache letterpress synth. Snackwave raw denim godard, 3 wolf moon shaman offal kitsch unicorn live-edge selvage schlitz fashion axe vaporware drinking vinegar prism. Shabby chic tacos artisan, chambray chicharrones cardigan leggings typewriter af pop-up williamsburg meditation PBR&B viral. You probably haven't heard of them DIY jean shorts subway tile fashion axe bushwick kitsch tumeric cloud bread vaporware freegan franzen pork belly chicharrones banh mi.`, 10 | `Man braid celiac synth freegan readymade, pitchfork fam salvia waistcoat lomo bitters gentrify four loko. Pitchfork semiotics post-ironic vegan. Tofu meditation microdosing hashtag semiotics venmo. Flexitarian vape tilde taiyaki. Prism poutine farm-to-table, messenger bag vegan taxidermy tattooed sartorial squid jean shorts fixie selvage trust fund vape.`, 11 | `Rutters Plate Fleet boom chandler Brethren of the Coast handsomely lookout marooned brigantine knave. Buccaneer gangway jack rum loot spyglass line Jack Tar fore gaff. Gaff topmast scuttle ballast swab draught measured fer yer chains dance the hempen jig Chain Shot yardarm.`, 12 | ]; 13 | 14 | const form = document.querySelector(".lorem-form"); 15 | const amount = document.getElementById("amount"); 16 | const result = document.querySelector(".lorem-text"); 17 | 18 | form.addEventListener("submit", function (e) { 19 | e.preventDefault(); 20 | 21 | const value = parseInt(amount.value); 22 | const random = Math.floor(Math.random() * text.length); 23 | 24 | // empty 25 | // -1 26 | // more than 9 27 | 28 | if (isNaN(value) || value <= 0 || value > 9) { 29 | result.innerHTML = `

${text[random]}

`; 30 | } 31 | else { 32 | let tempText = text.slice(0, value); 33 | tempText = tempText.map(function (item) { 34 | return `

${item}

`; 35 | }).join(""); 36 | result.innerHTML = tempText; 37 | } 38 | }); 39 | 40 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/drawable/lemon_squeeze.xml: -------------------------------------------------------------------------------- 1 | 16 | 21 | 24 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 60 | 63 | 66 | 69 | 70 | -------------------------------------------------------------------------------- /Go Programs/to-doapp.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "log" 7 | "net/http" 8 | "os" 9 | "os/signal" 10 | "strings" 11 | "time" 12 | 13 | "github.com/go-chi/chi" 14 | "github.com/go-chi/chi/middleware" 15 | "github.com/thedevsaddam/renderer" 16 | mgo "gopkg.in/mgo.v2" 17 | "gopkg.in/mgo.v2/bson" 18 | ) 19 | 20 | var rnd *renderer.Render 21 | var db *mgo.Database 22 | 23 | const ( 24 | hostName string = "localhost:27017" 25 | dbName string = "demo_todo" 26 | collectionName string = "todo" 27 | port string = ":9000" 28 | ) 29 | 30 | type ( 31 | todoModel struct { 32 | ID bson.ObjectId `bson:"_id,omitempty"` 33 | Title string `bson:"title"` 34 | Completed bool `bson:"completed"` 35 | CreatedAt time.Time `bson:"createAt"` 36 | } 37 | 38 | todo struct { 39 | ID string `json:"id"` 40 | Title string `json:"title"` 41 | Completed bool `json:"completed"` 42 | CreatedAt time.Time `json:"created_at"` 43 | } 44 | ) 45 | 46 | func init() { 47 | rnd = renderer.New() 48 | sess, err := mgo.Dial(hostName) 49 | checkErr(err) 50 | sess.SetMode(mgo.Monotonic, true) 51 | db = sess.DB(dbName) 52 | } 53 | 54 | func homeHandler(w http.ResponseWriter, r *http.Request) { 55 | err := rnd.Template(w, http.StatusOK, []string{"static/home.tpl"}, nil) 56 | checkErr(err) 57 | } 58 | 59 | func createTodo(w http.ResponseWriter, r *http.Request) { 60 | var t todo 61 | 62 | if err := json.NewDecoder(r.Body).Decode(&t); err != nil { 63 | rnd.JSON(w, http.StatusProcessing, err) 64 | return 65 | } 66 | 67 | // simple validation 68 | if t.Title == "" { 69 | rnd.JSON(w, http.StatusBadRequest, renderer.M{ 70 | "message": "The title field is requried", 71 | }) 72 | return 73 | } 74 | 75 | // if input is okay, create a todo 76 | tm := todoModel{ 77 | ID: bson.NewObjectId(), 78 | Title: t.Title, 79 | Completed: false, 80 | CreatedAt: time.Now(), 81 | } 82 | if err := db.C(collectionName).Insert(&tm); err != nil { 83 | rnd.JSON(w, http.StatusProcessing, renderer.M{ 84 | "message": "Failed to save todo", 85 | "error": err, 86 | }) 87 | return 88 | } 89 | 90 | rnd.JSON(w, http.StatusCreated, renderer.M{ 91 | "message": "Todo created successfully", 92 | "todo_id": tm.ID.Hex(), 93 | }) 94 | } 95 | 96 | func updateTodo(w http.ResponseWriter, r *http.Request) { 97 | id := strings.TrimSpace(chi.URLParam(r, "id")) 98 | 99 | if !bson.IsObjectIdHex(id) { 100 | rnd.JSON(w, http.StatusBadRequest, renderer.M{ 101 | "message": "The id is invalid", 102 | }) 103 | return 104 | } 105 | 106 | var t todo 107 | 108 | if err := json.NewDecoder(r.Body).Decode(&t); err != nil { 109 | rnd.JSON(w, http.StatusProcessing, err) 110 | return 111 | } 112 | 113 | // simple validation 114 | if t.Title == "" { 115 | rnd.JSON(w, http.StatusBadRequest, renderer.M{ 116 | "message": "The title field is requried", 117 | }) 118 | return 119 | } 120 | 121 | // if input is okay, update a todo 122 | if err := db.C(collectionName). 123 | Update( 124 | bson.M{"_id": bson.ObjectIdHex(id)}, 125 | bson.M{"title": t.Title, "completed": t.Completed}, 126 | ); err != nil { 127 | rnd.JSON(w, http.StatusProcessing, renderer.M{ 128 | "message": "Failed to update todo", 129 | "error": err, 130 | }) 131 | return 132 | } 133 | 134 | rnd.JSON(w, http.StatusOK, renderer.M{ 135 | "message": "Todo updated successfully", 136 | }) 137 | } 138 | 139 | func fetchTodos(w http.ResponseWriter, r *http.Request) { 140 | todos := []todoModel{} 141 | 142 | if err := db.C(collectionName). 143 | Find(bson.M{}). 144 | All(&todos); err != nil { 145 | rnd.JSON(w, http.StatusProcessing, renderer.M{ 146 | "message": "Failed to fetch todo", 147 | "error": err, 148 | }) 149 | return 150 | } 151 | 152 | todoList := []todo{} 153 | for _, t := range todos { 154 | todoList = append(todoList, todo{ 155 | ID: t.ID.Hex(), 156 | Title: t.Title, 157 | Completed: t.Completed, 158 | CreatedAt: t.CreatedAt, 159 | }) 160 | } 161 | 162 | rnd.JSON(w, http.StatusOK, renderer.M{ 163 | "data": todoList, 164 | }) 165 | } 166 | 167 | func deleteTodo(w http.ResponseWriter, r *http.Request) { 168 | id := strings.TrimSpace(chi.URLParam(r, "id")) 169 | 170 | if !bson.IsObjectIdHex(id) { 171 | rnd.JSON(w, http.StatusBadRequest, renderer.M{ 172 | "message": "The id is invalid", 173 | }) 174 | return 175 | } 176 | 177 | if err := db.C(collectionName).RemoveId(bson.ObjectIdHex(id)); err != nil { 178 | rnd.JSON(w, http.StatusProcessing, renderer.M{ 179 | "message": "Failed to delete todo", 180 | "error": err, 181 | }) 182 | return 183 | } 184 | 185 | rnd.JSON(w, http.StatusOK, renderer.M{ 186 | "message": "Todo deleted successfully", 187 | }) 188 | } 189 | 190 | func main() { 191 | stopChan := make(chan os.Signal) 192 | signal.Notify(stopChan, os.Interrupt) 193 | 194 | r := chi.NewRouter() 195 | r.Use(middleware.Logger) 196 | r.Get("/", homeHandler) 197 | 198 | r.Mount("/todo", todoHandlers()) 199 | 200 | srv := &http.Server{ 201 | Addr: port, 202 | Handler: r, 203 | ReadTimeout: 60 * time.Second, 204 | WriteTimeout: 60 * time.Second, 205 | IdleTimeout: 60 * time.Second, 206 | } 207 | 208 | go func() { 209 | log.Println("Listening on port ", port) 210 | if err := srv.ListenAndServe(); err != nil { 211 | log.Printf("listen: %s\n", err) 212 | } 213 | }() 214 | 215 | <-stopChan 216 | log.Println("Shutting down server...") 217 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) 218 | srv.Shutdown(ctx) 219 | defer cancel() 220 | log.Println("Server gracefully stopped!") 221 | } 222 | 223 | func todoHandlers() http.Handler { 224 | rg := chi.NewRouter() 225 | rg.Group(func(r chi.Router) { 226 | r.Get("/", fetchTodos) 227 | r.Post("/", createTodo) 228 | r.Put("/{id}", updateTodo) 229 | r.Delete("/{id}", deleteTodo) 230 | }) 231 | return rg 232 | } 233 | 234 | func checkErr(err error) { 235 | if err != nil { 236 | log.Fatal(err) //respond with error page or message 237 | } 238 | } 239 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /Android Projects/LemonApp/Lemonade/app/src/main/java/com/example/lemonade/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.lemonade 2 | 3 | import android.os.Bundle 4 | import androidx.activity.ComponentActivity 5 | import androidx.activity.compose.setContent 6 | import androidx.compose.foundation.* 7 | import androidx.compose.foundation.layout.Arrangement 8 | import androidx.compose.foundation.layout.Column 9 | import androidx.compose.foundation.layout.Spacer 10 | import androidx.compose.foundation.layout.fillMaxSize 11 | import androidx.compose.foundation.layout.height 12 | import androidx.compose.foundation.layout.padding 13 | import androidx.compose.foundation.layout.wrapContentSize 14 | import androidx.compose.foundation.shape.RoundedCornerShape 15 | import androidx.compose.material.MaterialTheme 16 | import androidx.compose.material.Surface 17 | import androidx.compose.material.Text 18 | import androidx.compose.runtime.Composable 19 | import androidx.compose.runtime.getValue 20 | import androidx.compose.runtime.mutableStateOf 21 | import androidx.compose.runtime.remember 22 | import androidx.compose.runtime.setValue 23 | import androidx.compose.ui.Alignment 24 | import androidx.compose.ui.Modifier 25 | import androidx.compose.ui.graphics.Color 26 | import androidx.compose.ui.res.painterResource 27 | import androidx.compose.ui.res.stringResource 28 | import androidx.compose.ui.tooling.preview.Preview 29 | import androidx.compose.ui.unit.dp 30 | import androidx.compose.ui.unit.sp 31 | import com.example.lemonade.ui.theme.LemonadeTheme 32 | 33 | class MainActivity : ComponentActivity() { 34 | 35 | override fun onCreate(savedInstanceState: Bundle?) { 36 | super.onCreate(savedInstanceState) 37 | setContent { 38 | LemonadeTheme() { 39 | LemonApp() 40 | } 41 | } 42 | } 43 | } 44 | 45 | @Composable 46 | fun LemonApp() { 47 | 48 | // Current step the app is displaying (remember allows the state to be retained 49 | // across recompositions). 50 | var currentStep by remember { mutableStateOf(1) } 51 | 52 | // Number of times the lemon needs to be squeezed to turn into a glass of lemonade 53 | var squeezeCount by remember { mutableStateOf(0) } 54 | 55 | Surface( 56 | modifier = Modifier.fillMaxSize(), 57 | color = MaterialTheme.colors.background 58 | ) { 59 | when (currentStep) { 60 | 1 -> { 61 | // Display lemon tree image and ask user to pick a lemon from the tree 62 | LemonTextAndImage( 63 | textLabelResourceId = R.string.lemonimage1, 64 | drawableResourceId = R.drawable.lemon_tree, 65 | contentDescriptionResourceId = R.string.lemon_content_description1, 66 | onImageClick = { 67 | // Update to next step 68 | currentStep = 2 69 | // Each time a lemon is picked from the tree, get a new random number 70 | // between 2 and 4 (inclusive) for the number of times the lemon needs 71 | // to be squeezed to turn into lemonade 72 | squeezeCount = (2..7).random() 73 | } 74 | ) 75 | } 76 | 2 -> { 77 | // Display lemon image and ask user to squeeze the lemon 78 | LemonTextAndImage( 79 | textLabelResourceId = R.string.lemonimage2, 80 | drawableResourceId = R.drawable.lemon_squeeze, 81 | contentDescriptionResourceId = R.string.lemon_content_description2, 82 | onImageClick = { 83 | // Decrease the squeeze count by 1 for each click the user performs 84 | squeezeCount-- 85 | // When we're done squeezing the lemon, move to the next step 86 | if (squeezeCount == 0) { 87 | currentStep = 3 88 | } 89 | } 90 | ) 91 | } 92 | 3 -> { 93 | // Display glass of lemonade image and ask user to drink the lemonade 94 | LemonTextAndImage( 95 | textLabelResourceId = R.string.lemonimage3, 96 | drawableResourceId = R.drawable.lemon_drink, 97 | contentDescriptionResourceId = R.string.lemon_content_description3, 98 | onImageClick = { 99 | // Update to next step 100 | currentStep = 4 101 | } 102 | ) 103 | } 104 | 4 -> { 105 | // Display empty glass image and ask user to start again 106 | LemonTextAndImage( 107 | textLabelResourceId = R.string.lemonimage4, 108 | drawableResourceId = R.drawable.lemon_restart, 109 | contentDescriptionResourceId = R.string.lemon_content_description4, 110 | onImageClick = { 111 | // Back to starting step 112 | currentStep = 1 113 | } 114 | ) 115 | } 116 | } 117 | } 118 | } 119 | 120 | 121 | @Composable 122 | fun LemonTextAndImage( 123 | textLabelResourceId: Int, 124 | drawableResourceId: Int, 125 | contentDescriptionResourceId: Int, 126 | onImageClick: () -> Unit, 127 | modifier: Modifier = Modifier 128 | ) { 129 | 130 | Column( 131 | horizontalAlignment = Alignment.CenterHorizontally, 132 | verticalArrangement = Arrangement.Center, 133 | modifier = modifier 134 | .fillMaxSize() 135 | .background(color = Color.Yellow) 136 | 137 | ) { 138 | Text( 139 | text = stringResource(textLabelResourceId), 140 | fontSize = 20.sp, 141 | color=Color.Green 142 | ) 143 | Spacer(modifier = Modifier.height(16.dp)) 144 | Image( 145 | painter = painterResource(drawableResourceId), 146 | contentDescription = stringResource(contentDescriptionResourceId), 147 | modifier = Modifier 148 | .wrapContentSize() 149 | .clickable( 150 | onClick = onImageClick 151 | ) 152 | .border( 153 | BorderStroke(2.dp, Color(105, 205, 216)), 154 | shape = RoundedCornerShape(4.dp) 155 | ) 156 | .padding(16.dp) 157 | ) 158 | } 159 | } 160 | 161 | @Preview 162 | @Composable 163 | fun LemonPreview() { 164 | LemonadeTheme() { 165 | LemonApp() 166 | } 167 | } --------------------------------------------------------------------------------