From 7ecd444efb1a44da36975adbb83c2f80f44aa084 Mon Sep 17 00:00:00 2001 From: Sami Date: Tue, 15 Oct 2024 11:03:57 -0400 Subject: [PATCH] adding old solved challenges --- AnagramPeriod/AnagramPeriod.class | Bin 0 -> 567 bytes AnagramPeriod/AnagramPeriod.java | 12 +++ AngryProfessor/.idea/.gitignore | 3 + AngryProfessor/.idea/aws.xml | 11 ++ AngryProfessor/.idea/codeStyles/Project.xml | 7 ++ .../.idea/codeStyles/codeStyleConfig.xml | 5 + AngryProfessor/.idea/misc.xml | 6 ++ AngryProfessor/.idea/modules.xml | 8 ++ AngryProfessor/.idea/vcs.xml | 6 ++ AngryProfessor/AngryProf.class | Bin 0 -> 1019 bytes AngryProfessor/AngryProf.java | 32 ++++++ AngryProfessor/AngryProfessor.iml | 11 ++ .../AngryProfessor/.idea/.gitignore | 3 + .../AngryProfessor/.idea/aws.xml | 11 ++ .../.idea/codeStyles/Project.xml | 7 ++ .../.idea/codeStyles/codeStyleConfig.xml | 5 + .../AngryProfessor/.idea/misc.xml | 6 ++ .../AngryProfessor/.idea/modules.xml | 8 ++ .../AngryProfessor/.idea/vcs.xml | 6 ++ .../AngryProfessor/AngryProf.class | Bin 0 -> 1527 bytes .../AngryProfessor/AngryProfessor.iml | 11 ++ ArraySum | 1 + BasketBallRecords | 1 + BeautifulDay/BeautifulDay.iml | 11 ++ BeautifulDay/BeautifulDays.java | 50 +++++++++ .../production/BeautifulDay/.idea/.gitignore | 3 + .../out/production/BeautifulDay/.idea/aws.xml | 11 ++ .../BeautifulDay/.idea/codeStyles/Project.xml | 7 ++ .../.idea/codeStyles/codeStyleConfig.xml | 5 + .../production/BeautifulDay/.idea/misc.xml | 6 ++ .../production/BeautifulDay/.idea/modules.xml | 8 ++ .../out/production/BeautifulDay/.idea/vcs.xml | 6 ++ .../production/BeautifulDay/BeautifulDay.iml | 11 ++ .../BeautifulDay/BeautifulDays.class | Bin 0 -> 1115 bytes BinarySearch/BinarySearch.class | Bin 0 -> 1578 bytes BinarySearch/BinarySearch.java | 42 ++++++++ BirdsMigration/BirdsMigration.class | Bin 0 -> 1189 bytes BirdsMigration/BirdsMigration.java | 35 +++++++ "BirdsMigration/\\" | 35 +++++++ BobConundrum/.idea/workspace.xml | 96 ++++++++++++++++++ BobConundrum/BobConundrum.iml | 11 ++ BobConundrum/BobConundrumSolution.class | Bin 0 -> 700 bytes BobConundrum/BobConundrumSolution.java | 0 Grades/.gitignore | 2 + Grades/.idea/.gitignore | 3 + Grades/.idea/aws.xml | 11 ++ Grades/.idea/codeStyles/Project.xml | 7 ++ Grades/.idea/codeStyles/codeStyleConfig.xml | 5 + Grades/.idea/misc.xml | 6 ++ Grades/.idea/modules.xml | 8 ++ Grades/.idea/vcs.xml | 6 ++ Grades/RoundGrades.java | 35 +++++++ Min_Max/.idea/.gitignore | 3 + Min_Max/.idea/aws.xml | 11 ++ Min_Max/.idea/codeStyles/Project.xml | 7 ++ Min_Max/.idea/codeStyles/codeStyleConfig.xml | 5 + Min_Max/.idea/misc.xml | 6 ++ Min_Max/.idea/modules.xml | 8 ++ Min_Max/.idea/vcs.xml | 6 ++ Min_Max/MinMaxSum.class | Bin 0 -> 1410 bytes Min_Max/MinMaxSum.java | 39 +++++++ Min_Max/Min_Max.iml | 11 ++ .../Min_Max/Min_Max/.idea/.gitignore | 3 + .../production/Min_Max/Min_Max/.idea/aws.xml | 11 ++ .../Min_Max/.idea/codeStyles/Project.xml | 7 ++ .../.idea/codeStyles/codeStyleConfig.xml | 5 + .../production/Min_Max/Min_Max/.idea/misc.xml | 6 ++ .../Min_Max/Min_Max/.idea/modules.xml | 8 ++ .../production/Min_Max/Min_Max/.idea/vcs.xml | 6 ++ .../Min_Max/Min_Max/MinMaxSum.class | Bin 0 -> 2080 bytes .../production/Min_Max/Min_Max/Min_Max.iml | 11 ++ ParenthesesBalance/ParenthesesBalance.java | 0 PerfectNumber/ThePerfectNumber.class | Bin 0 -> 1282 bytes PerfectNumber/ThePerfectNumber.java | 22 ++++ ReverseIntegers/.idea/.gitignore | 3 + ReverseIntegers/.idea/aws.xml | 11 ++ ReverseIntegers/.idea/codeStyles/Project.xml | 7 ++ .../.idea/codeStyles/codeStyleConfig.xml | 5 + ReverseIntegers/.idea/misc.xml | 6 ++ ReverseIntegers/.idea/modules.xml | 8 ++ ReverseIntegers/.idea/vcs.xml | 6 ++ ReverseIntegers/ReverseIntegers.class | Bin 0 -> 694 bytes ReverseIntegers/ReverseIntegers.iml | 11 ++ ReverseIntegers/ReverseIntegers.java | 26 +++++ .../ReverseIntegers/.idea/.gitignore | 3 + .../ReverseIntegers/.idea/aws.xml | 11 ++ .../.idea/codeStyles/Project.xml | 7 ++ .../.idea/codeStyles/codeStyleConfig.xml | 5 + .../ReverseIntegers/.idea/misc.xml | 6 ++ .../ReverseIntegers/.idea/modules.xml | 8 ++ .../ReverseIntegers/.idea/vcs.xml | 6 ++ .../ReverseIntegers/ReverseIntegers.class | Bin 0 -> 1043 bytes .../ReverseIntegers/ReverseIntegers.iml | 11 ++ StairCase/StairCase.class | Bin 0 -> 792 bytes StairCase/StairCase.java | 16 +++ SubString/.gitignore | 3 + SubString/SubString.java | 25 +++++ TallestCandle/.idea/.gitignore | 3 + TallestCandle/.idea/aws.xml | 11 ++ TallestCandle/.idea/codeStyles/Project.xml | 7 ++ .../.idea/codeStyles/codeStyleConfig.xml | 5 + TallestCandle/.idea/misc.xml | 6 ++ TallestCandle/.idea/modules.xml | 8 ++ TallestCandle/.idea/vcs.xml | 6 ++ TallestCandle/TallestCandles.class | Bin 0 -> 1223 bytes TallestCandle/TallestCandles.java | 39 +++++++ smallString/failedTest.java | 32 ++++++ 107 files changed, 1056 insertions(+) create mode 100644 AnagramPeriod/AnagramPeriod.class create mode 100644 AnagramPeriod/AnagramPeriod.java create mode 100644 AngryProfessor/.idea/.gitignore create mode 100644 AngryProfessor/.idea/aws.xml create mode 100644 AngryProfessor/.idea/codeStyles/Project.xml create mode 100644 AngryProfessor/.idea/codeStyles/codeStyleConfig.xml create mode 100644 AngryProfessor/.idea/misc.xml create mode 100644 AngryProfessor/.idea/modules.xml create mode 100644 AngryProfessor/.idea/vcs.xml create mode 100644 AngryProfessor/AngryProf.class create mode 100644 AngryProfessor/AngryProf.java create mode 100644 AngryProfessor/AngryProfessor.iml create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/.gitignore create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/aws.xml create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/codeStyles/Project.xml create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/codeStyles/codeStyleConfig.xml create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/misc.xml create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/modules.xml create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/vcs.xml create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/AngryProf.class create mode 100644 AngryProfessor/out/production/AngryProfessor/AngryProfessor/AngryProfessor.iml create mode 160000 ArraySum create mode 160000 BasketBallRecords create mode 100644 BeautifulDay/BeautifulDay.iml create mode 100644 BeautifulDay/BeautifulDays.java create mode 100644 BeautifulDay/out/production/BeautifulDay/.idea/.gitignore create mode 100644 BeautifulDay/out/production/BeautifulDay/.idea/aws.xml create mode 100644 BeautifulDay/out/production/BeautifulDay/.idea/codeStyles/Project.xml create mode 100644 BeautifulDay/out/production/BeautifulDay/.idea/codeStyles/codeStyleConfig.xml create mode 100644 BeautifulDay/out/production/BeautifulDay/.idea/misc.xml create mode 100644 BeautifulDay/out/production/BeautifulDay/.idea/modules.xml create mode 100644 BeautifulDay/out/production/BeautifulDay/.idea/vcs.xml create mode 100644 BeautifulDay/out/production/BeautifulDay/BeautifulDay.iml create mode 100644 BeautifulDay/out/production/BeautifulDay/BeautifulDays.class create mode 100644 BinarySearch/BinarySearch.class create mode 100644 BinarySearch/BinarySearch.java create mode 100644 BirdsMigration/BirdsMigration.class create mode 100644 BirdsMigration/BirdsMigration.java create mode 100644 "BirdsMigration/\\" create mode 100644 BobConundrum/.idea/workspace.xml create mode 100644 BobConundrum/BobConundrum.iml create mode 100644 BobConundrum/BobConundrumSolution.class create mode 100644 BobConundrum/BobConundrumSolution.java create mode 100644 Grades/.gitignore create mode 100644 Grades/.idea/.gitignore create mode 100644 Grades/.idea/aws.xml create mode 100644 Grades/.idea/codeStyles/Project.xml create mode 100644 Grades/.idea/codeStyles/codeStyleConfig.xml create mode 100644 Grades/.idea/misc.xml create mode 100644 Grades/.idea/modules.xml create mode 100644 Grades/.idea/vcs.xml create mode 100644 Grades/RoundGrades.java create mode 100644 Min_Max/.idea/.gitignore create mode 100644 Min_Max/.idea/aws.xml create mode 100644 Min_Max/.idea/codeStyles/Project.xml create mode 100644 Min_Max/.idea/codeStyles/codeStyleConfig.xml create mode 100644 Min_Max/.idea/misc.xml create mode 100644 Min_Max/.idea/modules.xml create mode 100644 Min_Max/.idea/vcs.xml create mode 100644 Min_Max/MinMaxSum.class create mode 100644 Min_Max/MinMaxSum.java create mode 100644 Min_Max/Min_Max.iml create mode 100644 Min_Max/out/production/Min_Max/Min_Max/.idea/.gitignore create mode 100644 Min_Max/out/production/Min_Max/Min_Max/.idea/aws.xml create mode 100644 Min_Max/out/production/Min_Max/Min_Max/.idea/codeStyles/Project.xml create mode 100644 Min_Max/out/production/Min_Max/Min_Max/.idea/codeStyles/codeStyleConfig.xml create mode 100644 Min_Max/out/production/Min_Max/Min_Max/.idea/misc.xml create mode 100644 Min_Max/out/production/Min_Max/Min_Max/.idea/modules.xml create mode 100644 Min_Max/out/production/Min_Max/Min_Max/.idea/vcs.xml create mode 100644 Min_Max/out/production/Min_Max/Min_Max/MinMaxSum.class create mode 100644 Min_Max/out/production/Min_Max/Min_Max/Min_Max.iml create mode 100644 ParenthesesBalance/ParenthesesBalance.java create mode 100644 PerfectNumber/ThePerfectNumber.class create mode 100644 PerfectNumber/ThePerfectNumber.java create mode 100644 ReverseIntegers/.idea/.gitignore create mode 100644 ReverseIntegers/.idea/aws.xml create mode 100644 ReverseIntegers/.idea/codeStyles/Project.xml create mode 100644 ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml create mode 100644 ReverseIntegers/.idea/misc.xml create mode 100644 ReverseIntegers/.idea/modules.xml create mode 100644 ReverseIntegers/.idea/vcs.xml create mode 100644 ReverseIntegers/ReverseIntegers.class create mode 100644 ReverseIntegers/ReverseIntegers.iml create mode 100644 ReverseIntegers/ReverseIntegers.java create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/.gitignore create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/aws.xml create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/codeStyles/Project.xml create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/misc.xml create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/modules.xml create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/vcs.xml create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/ReverseIntegers.class create mode 100644 ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/ReverseIntegers.iml create mode 100644 StairCase/StairCase.class create mode 100644 StairCase/StairCase.java create mode 100644 SubString/.gitignore create mode 100644 SubString/SubString.java create mode 100644 TallestCandle/.idea/.gitignore create mode 100644 TallestCandle/.idea/aws.xml create mode 100644 TallestCandle/.idea/codeStyles/Project.xml create mode 100644 TallestCandle/.idea/codeStyles/codeStyleConfig.xml create mode 100644 TallestCandle/.idea/misc.xml create mode 100644 TallestCandle/.idea/modules.xml create mode 100644 TallestCandle/.idea/vcs.xml create mode 100644 TallestCandle/TallestCandles.class create mode 100644 TallestCandle/TallestCandles.java create mode 100644 smallString/failedTest.java diff --git a/AnagramPeriod/AnagramPeriod.class b/AnagramPeriod/AnagramPeriod.class new file mode 100644 index 0000000000000000000000000000000000000000..3a84486f3aba9a41eb21173e87ed86af35e83326 GIT binary patch literal 567 zcmZuu+fKqj5IqZ&LMehEctKR~R!Ec&fM|?~2?r_gd;pFyq}xsrcuVaiVYo`*owlRA4B01%Ab<+(n8DjTYVA=sh8kx zTf;W0Dt2`2VvnIX_Y=i1s1K6icnk@n+Za;1^v8lB*RwrwJ#|eH+;Y>QO2Xwf!OF(n ze?Mc;2L3b{i7Q)z3z2c0N@>(+h%s6Q5C@Z6pje|@l`^BOG~d8p=)h2?D4#)uH1=^o zX9=xSmepiIeMfqUT{KqaO*OfrU;GL2rDV1_L$33RQe}q9lD0xlKmrOm(~%+4A>Cs* F`T + + + + + \ No newline at end of file diff --git a/AngryProfessor/.idea/codeStyles/Project.xml b/AngryProfessor/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/AngryProfessor/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/AngryProfessor/.idea/codeStyles/codeStyleConfig.xml b/AngryProfessor/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/AngryProfessor/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/AngryProfessor/.idea/misc.xml b/AngryProfessor/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/AngryProfessor/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AngryProfessor/.idea/modules.xml b/AngryProfessor/.idea/modules.xml new file mode 100644 index 0000000..a432249 --- /dev/null +++ b/AngryProfessor/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/AngryProfessor/.idea/vcs.xml b/AngryProfessor/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/AngryProfessor/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AngryProfessor/AngryProf.class b/AngryProfessor/AngryProf.class new file mode 100644 index 0000000000000000000000000000000000000000..7743dd115d5729d5029bd210863d515d1d27ed1b GIT binary patch literal 1019 zcmZuvT~8BH5IxgwyX|&?QfT=Q5KweWg`#Lxijc-cZBmO#4Fr6;z)}~>)@-*#662G9 z!Ux|>e8m@`ni!w`7ybREQPlgK}yFB%*Z}$cU6+=LF7Y76MV&L2shcVZq^v-VRf6mJq61)i}k%t z(|Im7D{N8rgk{V2Uv#k995uO0=qkBl>(x{7x)~oXS!G+eb%%2o&JniQ0n*%ecIhG( z30kRIcecz&mh7Uvi&@DKQ!v1vQXW4@eoMY@@oSVNu?$QffxfUpnCDx%&s5wu?(=x_#dPi7$FpA8W<;hzz8eX2tN_|is_6JS3V;6-bbJR z{T>B(?(Hml4@UhaF^!hh;w+UfuR literal 0 HcmV?d00001 diff --git a/AngryProfessor/AngryProf.java b/AngryProfessor/AngryProf.java new file mode 100644 index 0000000..3c44af7 --- /dev/null +++ b/AngryProfessor/AngryProf.java @@ -0,0 +1,32 @@ +package AngryProfessor; + +import java.util.ArrayList; +import java.util.List; + +public class AngryProf { + public static void main(String[] args) { + + List a = new ArrayList<>(); + a.add(0); + a.add(1); + a.add(2); + a.add(2); + a.add(3); + String answer = AngryProfessor(2, a); + System.out.println(answer); + } + + public static String AngryProfessor(int k, List a) { + + int numOnTime = 0; + for (int x : a) { + if (x <= 0) { + numOnTime++; + } + } + if (numOnTime > k) { + return "No"; + } + return "Yes"; + } +} diff --git a/AngryProfessor/AngryProfessor.iml b/AngryProfessor/AngryProfessor.iml new file mode 100644 index 0000000..1a48ba3 --- /dev/null +++ b/AngryProfessor/AngryProfessor.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/.gitignore b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/aws.xml b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/codeStyles/Project.xml b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/codeStyles/codeStyleConfig.xml b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/misc.xml b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/modules.xml b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/modules.xml new file mode 100644 index 0000000..a432249 --- /dev/null +++ b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/vcs.xml b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/AngryProf.class b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/AngryProf.class new file mode 100644 index 0000000000000000000000000000000000000000..e207f1927ed0b7df14cb09b8211feb9eb07f3bca GIT binary patch literal 1527 zcmZuxTUQfT6#mX+l1ajFF_=h^QnaEI0>svqwgxEFYMUAYHZ)z@rvr>}G?`&dCRX14 z6Mg7g*YXwnfTF8iKKn2H8?M#McP4>^%d9o$?6WW5{`Nk5=Iy_){sypsY7!bE26Piq z!~}*O%EvNamu@Y;y7AE730UVA#Z2qy+}Lxl|gmkXu^< zX{#r+&9socm&7@Y82G@%D9#IvEW0&-XU+HS+s&ru=MRsBJ(NR}z@$}dBZg(ERE1u4 zmB4r0S|NcCF>c@^6BD>_q+6ApW?(l+&ufunx{c*{`8CD`jJ9Q?ki^HhWMI<7Wn4LE z<53?rXj?_p-D5R&2xP0OKUot~$O*)q!1iU}v9B4cLpS7K?C9Ce8O$2Uo4ATk1XA5@ z9=I^$1KBLwPgHNM>^&86&BSN;TtIh2_1OdLp1EK#efYw}m-tHYaD%G4*ASu@M?pX< zdvPpKao27V>4vvO>tM-o?Q*NJVf*WHqfSk#F6zWFOc|p zLpp3y#`>ja5)QjWyYy?s7(T@;AS5sE_RCQ}`yy0d*ick&q0d{1;| z@C%EiES~T!@_i(ba9fR4cim~Q2mO^mZa!L(+nw?g6{qIPpyktc{lr|Jj(*Cp3M4CD z%ipwbIjYm$k)KslfD8OsH2wsD2!#6jxi0dQ=PtNMr(Qrjr=a0$uF9;|C9Y=M0n7M? zrvz@`TWVDBU+Qnd{3G;DHrhriQcAO zmD0AAC?(X7gBDfF8}3o=bCHGIJ}iOq%s!?Ce#01rPX!(N_Aoc6r}f_vd#Z_N|GgU< z{R6So_1)C`E+h4j^F`tVX`*Gw=^Q380*iTa%yboFxW+1$=rKkA3Hq*}Oo@51N=ZF) p9p)PAT%)ebylqp=@6c}m`aehr12g0Ap&9s*It>+C*F)*2{{cp3P~HFl literal 0 HcmV?d00001 diff --git a/AngryProfessor/out/production/AngryProfessor/AngryProfessor/AngryProfessor.iml b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/AngryProfessor.iml new file mode 100644 index 0000000..1a48ba3 --- /dev/null +++ b/AngryProfessor/out/production/AngryProfessor/AngryProfessor/AngryProfessor.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ArraySum b/ArraySum new file mode 160000 index 0000000..db216c9 --- /dev/null +++ b/ArraySum @@ -0,0 +1 @@ +Subproject commit db216c988bb8fc331e1863e125a1db09d37b4fff diff --git a/BasketBallRecords b/BasketBallRecords new file mode 160000 index 0000000..fd9140c --- /dev/null +++ b/BasketBallRecords @@ -0,0 +1 @@ +Subproject commit fd9140c61f6c82b92d743303898489974ae29830 diff --git a/BeautifulDay/BeautifulDay.iml b/BeautifulDay/BeautifulDay.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/BeautifulDay/BeautifulDay.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/BeautifulDay/BeautifulDays.java b/BeautifulDay/BeautifulDays.java new file mode 100644 index 0000000..a625967 --- /dev/null +++ b/BeautifulDay/BeautifulDays.java @@ -0,0 +1,50 @@ +public class BeautifulDays { + public static void main(String[] args) { + + int x = beautifulDays(20 , 23, 2); + System.out.println(x); + } + + public static int ReverseInt(int a){ + int revA = 0; + int remainder = 0; + while (a != 0){ + remainder = a % 10; + revA *= 10; + revA += remainder; + a = a / 10; + } + return revA; + } + + public static int beautifulDays(int i, int j, int k) { + + int beauxJours = 0; + int m =0; + int h =0; + for (int x = i; x <= j; x++) { + m = ReverseInt(x); + + h = (Math.abs(x - m) % k); + if (h == 0) { + + beauxJours++; + } + } + System.out.println(m); + System.out.println(h); + return beauxJours; + } + /* + int count = 0 ; + for (int l = i; l <= j; l++) { + int m = reverseit(l); + if (Math.abs(l-m) % k == 0) { + count++; + System.out.println(count+")"+l +"-"+reverseit(l) +"="+Math.abs(l-m)+"("+k+")"); + } + } + return count ; +*/ + +} diff --git a/BeautifulDay/out/production/BeautifulDay/.idea/.gitignore b/BeautifulDay/out/production/BeautifulDay/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/BeautifulDay/out/production/BeautifulDay/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/BeautifulDay/out/production/BeautifulDay/.idea/aws.xml b/BeautifulDay/out/production/BeautifulDay/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/BeautifulDay/out/production/BeautifulDay/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/BeautifulDay/out/production/BeautifulDay/.idea/codeStyles/Project.xml b/BeautifulDay/out/production/BeautifulDay/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/BeautifulDay/out/production/BeautifulDay/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/BeautifulDay/out/production/BeautifulDay/.idea/codeStyles/codeStyleConfig.xml b/BeautifulDay/out/production/BeautifulDay/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/BeautifulDay/out/production/BeautifulDay/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/BeautifulDay/out/production/BeautifulDay/.idea/misc.xml b/BeautifulDay/out/production/BeautifulDay/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/BeautifulDay/out/production/BeautifulDay/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BeautifulDay/out/production/BeautifulDay/.idea/modules.xml b/BeautifulDay/out/production/BeautifulDay/.idea/modules.xml new file mode 100644 index 0000000..7cf2afe --- /dev/null +++ b/BeautifulDay/out/production/BeautifulDay/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/BeautifulDay/out/production/BeautifulDay/.idea/vcs.xml b/BeautifulDay/out/production/BeautifulDay/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/BeautifulDay/out/production/BeautifulDay/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BeautifulDay/out/production/BeautifulDay/BeautifulDay.iml b/BeautifulDay/out/production/BeautifulDay/BeautifulDay.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/BeautifulDay/out/production/BeautifulDay/BeautifulDay.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/BeautifulDay/out/production/BeautifulDay/BeautifulDays.class b/BeautifulDay/out/production/BeautifulDay/BeautifulDays.class new file mode 100644 index 0000000000000000000000000000000000000000..f616eab91851be829e89fb6c95702041dfd6b64b GIT binary patch literal 1115 zcmZuwOHUI~7(KT$ouR`3<wYbi0Cj(^urVwSaIyO@4ji*R_%jb=9S)D z%UG6`wIUeAkdCN{VT|;Uln-`&r%vojeX2i0O!%7{`Rb z=ovKvdP|E?sK&0a z8TDav!x0!Nxee!OyIyg;mv*Jbm61}jYS-3n&y{(1QT4Z69vUk3SW+NN-F7J}o_W>j zE-;s^xsA<2cAfjSx5)|cjz!1A$Iy$PF_8L#(Nmy7mPpPBIirM? zfbq^DWHBEA_Te(F5HcdaYZv-0YvjoprKl_=-yxBV8m*;N)YvMf(yxomYK5bdU#X9* zQ3A=c>`=-J!608hGZO>+jqsAjF~qAe9I(%HaB-EKvfU{x1nergbBsc`#&x>&7pf2m zBJwZMRrQ;@I(JuVvOm`u0w;aK=Rv_nN4YU1eR zC!L9@v_{Th&XcFg7m43-Wt=WekUK%GNk(ZZo}^FH)Rn*@O~1!pSGX#Dd`vC<{2bCf zO{&6mM)Fx@t#njIHyDNZTft363K{O>79*8BMdTTUgO10boDfbIorl){;f}y-%lJ>6#gzdyR%G(^1y^0fY{1{o&jc^xAd73kl#w(NP&ty#f`POwR<8CY&W7Y0vi>5LLa zk&b(ZB71RJM-F*~hr+N9+B*p{~@~?*4@)-zBgr~m9Q*$M1KfQ~A&wF)SpnJ)2 z?RR#!H*9~!+Gub_*|r?&@5`;7-j-h#=&A%(ZEM-uiTEn633RNL1hk5`>(}f>Cv=i- zzl8BH)y&?U=LOBcw|188VAHENyA!yfVHz_kX2W>j5Eyw{IF5VI+p;HG>1ZWx(W(WW zzbEirdm@gBEvL6Ex8AUuBTJsQwYxKQT0+~*GaFa-cI-3g?MY~r@>F{|k6p}LjYh=@ z?5QN?m=0kku^=$FvT2(Qs~MP%Tem+ky^qXb(`lMf?U*!#$!Ixeo6AnU&cq!PqowKT z8B?&jORj7C^K{d+n=0NC7(JDvv!tuwom}{TD&IycPb}FKUvT)vSUr5h#FseA^3UQz zyznc;FEj*RCWgx)wG*%4RoWr-Hz<*dALPLAS~Vv1a#fM3ay2exxtfsaa#fWdl&i^P zxhfN~KvZQvF)540PPtChY3A*;t^He~J!BZ8!Vk7#VGCIRn(h?#@DJ03&Z)4MiL!~}b zc!I&gq%x=+7UQvE!blkL2gnX8Mq<3EKE_2uJ-{VkA1{2K5D$<34!%@cRXTX z9nl@E!l2#7Q3`B^?4)VFp$zXLjcaTMv+M;67{F}|;yv~;3qx>tp&l;aV_d|iy!6i) z_!r#uB}VZzF5?^ao7d>|64WE~K~+%{LPQAs1ylV8lR{{JLu0$g^(dCtG0A^eK2uEK S%?Ri5Cg(Jc7jX-3WAHywl41`4 literal 0 HcmV?d00001 diff --git a/BinarySearch/BinarySearch.java b/BinarySearch/BinarySearch.java new file mode 100644 index 0000000..24d47b0 --- /dev/null +++ b/BinarySearch/BinarySearch.java @@ -0,0 +1,42 @@ +import java.util.Arrays; + +public class BinarySearch { + public static void main(String[] args) { + int[] seriesofNumbers = { 12, 14, 16, 17, 85, 5, 42, 23, 54, 96, 56, 45, 43, 32, 99, 33, 6, 77, 66, 98, 56, 43, 21, + 22 }; + + System.err.println(BinarySearchDo(seriesofNumbers, 33)); + } + + public static int BinarySearchDo(int[] sortedNumbers, int wantedNumber) { + // let's set the first and last indecies of the array + int left = 0; + int right = sortedNumbers.length - 1; + // we sort the array just in case it is a series of random numbers + Arrays.sort(sortedNumbers); + for (int sortedNum : sortedNumbers) { + System.out.print(sortedNum + " "); + } + System.out.println(""); + // let's split the array into 2 and compare if the middle number is lower or + // larger than the wanted number + while (left <= right) { + int middleIndex = (left + right) / 2; + int middleNumber = sortedNumbers[middleIndex]; + System.out.println("The last index of this Array is " + right + " and the Middile index is " + middleIndex + + " ==> " + middleNumber); + System.out.println(""); + if (wantedNumber == middleNumber) { + System.out.println(""); + return middleIndex; + } + if (wantedNumber < middleNumber) { + right = middleIndex - 1; + } + if (wantedNumber > middleNumber) { + left = middleIndex + 1; + } + } + return -1; + } +} diff --git a/BirdsMigration/BirdsMigration.class b/BirdsMigration/BirdsMigration.class new file mode 100644 index 0000000000000000000000000000000000000000..67d12eacef3ef27d36fe2816d0bf6f6cbd5c90cf GIT binary patch literal 1189 zcmZuw+fvg|6kVsc&=3j~TCPP=!Gucd6~%G~kzl!uMI6Bg4>Xown=)z2z`L)0fNzd3 zyfEYF0~d7|pZx;A!Vh2^a3_>0D3h6FpOd}UT6^tteja^205FIrB3y6_@JR5&$56A% z*Lgh4jZA!IX;oXc7<_%Yp<4qCZdsWZP{B~=Bo!?^8y_}JzM0eumIwiE5tWbxR7nV+ znxVD~rW%%((M$$moo9>M%xi|QtSZU>G7^=jMNmMUgnEP+0%b0nhE(u$njs{gDLqk| zP!{}XK%;;r3C(CZ*Gy`&U}-t3&KC(IbW*J6dXdD}g=%{SpQ+csdcMc8Xgol#}Bd z3|?7P6_rRv^JyxqPU?m>UCb?M<{V$j(vBy`b?Q1SFP<44S+5(Jgfh=im9qHqn<>8L z*Qa4iy`Kc#03ZWT?!kpFeP?+jMyj3owW6f~_=zGyCMAxMAdw!i6vX!Muz&0L zmwO-*J@|-VG!kq50B>abt($Ef|8{Q^s>`t?Mmm5H@r3F6H=+YgbljTJgBJ9nm2x7O pAhnYe&yun+%5H%72mt|)n1Jp>bo~KifkT3L?7&Wtv#JwK{sq*5{j>l8 literal 0 HcmV?d00001 diff --git a/BirdsMigration/BirdsMigration.java b/BirdsMigration/BirdsMigration.java new file mode 100644 index 0000000..df7ede6 --- /dev/null +++ b/BirdsMigration/BirdsMigration.java @@ -0,0 +1,35 @@ + +import java.util.ArrayList; +import java.util.List; + +public class BirdsMigration { + public static void main(String[] args) { + + List BirdType = new ArrayList<>(); + BirdType.add(1); + BirdType.add(3); + BirdType.add(3); + BirdType.add(2); + BirdType.add(2); + BirdType.add(2); + + System.out.println(smallestID(BirdType)); + + } + + private static int smallestID(List birds) { + int[] birdsTypeId = new int[6]; + int max = 0; + + for (int bird : birds) { + birdsTypeId[bird]++; + max = Math.max(max, birdsTypeId[bird]); + } + for (int i = 0; i < birdsTypeId.length; i++) { + if (birdsTypeId[i] == max) { + return i; + } + } + return 0; + } +} diff --git "a/BirdsMigration/\\" "b/BirdsMigration/\\" new file mode 100644 index 0000000..df7ede6 --- /dev/null +++ "b/BirdsMigration/\\" @@ -0,0 +1,35 @@ + +import java.util.ArrayList; +import java.util.List; + +public class BirdsMigration { + public static void main(String[] args) { + + List BirdType = new ArrayList<>(); + BirdType.add(1); + BirdType.add(3); + BirdType.add(3); + BirdType.add(2); + BirdType.add(2); + BirdType.add(2); + + System.out.println(smallestID(BirdType)); + + } + + private static int smallestID(List birds) { + int[] birdsTypeId = new int[6]; + int max = 0; + + for (int bird : birds) { + birdsTypeId[bird]++; + max = Math.max(max, birdsTypeId[bird]); + } + for (int i = 0; i < birdsTypeId.length; i++) { + if (birdsTypeId[i] == max) { + return i; + } + } + return 0; + } +} diff --git a/BobConundrum/.idea/workspace.xml b/BobConundrum/.idea/workspace.xml new file mode 100644 index 0000000..6cf1104 --- /dev/null +++ b/BobConundrum/.idea/workspace.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1706911947169 + + + + + + + \ No newline at end of file diff --git a/BobConundrum/BobConundrum.iml b/BobConundrum/BobConundrum.iml new file mode 100644 index 0000000..d5ecf6d --- /dev/null +++ b/BobConundrum/BobConundrum.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/BobConundrum/BobConundrumSolution.class b/BobConundrum/BobConundrumSolution.class new file mode 100644 index 0000000000000000000000000000000000000000..07dd398e56bb6ca4cc8c0361a6e97a2c7a51a90e GIT binary patch literal 700 zcmZuv%Wl&^6g^`noy2uWNN7t+LJ3bhk;sN!c?c{aA%%w&)J3yloLb2g+f$h_Qulla zV#B5zSQNyfAHZ+$7f3wrI6|aSH*@cuIrp4%XXg9wZzljApzpwf%~5hu#tK7YU%VB= zSfsPz^Kd_!YKE1&GL`y1gYEe{4l1Z}I4)MQ)Nf(r~AVG@b-NgT&vl*!p#hhq9V z%t8n2*xP`T zB(<-5lQT>Zp)*!_HjN%jL(*P0{%@Y!#u<8a4Hi8pV1t>Lq_sy?mm;HB?tcOMLk>kLjlpgZW?X@u`lA9TvEimY5ZdS|hZe}33U1hxvg zO(Fz1=~hr9(k(bdS-~x;uF**i_AhXb>#Y5gKvmqNqlKzR6vm7D8MS8XE7p#2>Az3& QIe{kqwHBc~$}RYR0cM$#cmMzZ literal 0 HcmV?d00001 diff --git a/BobConundrum/BobConundrumSolution.java b/BobConundrum/BobConundrumSolution.java new file mode 100644 index 0000000..e69de29 diff --git a/Grades/.gitignore b/Grades/.gitignore new file mode 100644 index 0000000..175ad2b --- /dev/null +++ b/Grades/.gitignore @@ -0,0 +1,2 @@ +RoundGrades.class +Grades.iml diff --git a/Grades/.idea/.gitignore b/Grades/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Grades/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Grades/.idea/aws.xml b/Grades/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/Grades/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/Grades/.idea/codeStyles/Project.xml b/Grades/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/Grades/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/Grades/.idea/codeStyles/codeStyleConfig.xml b/Grades/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/Grades/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Grades/.idea/misc.xml b/Grades/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/Grades/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Grades/.idea/modules.xml b/Grades/.idea/modules.xml new file mode 100644 index 0000000..74173e0 --- /dev/null +++ b/Grades/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Grades/.idea/vcs.xml b/Grades/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Grades/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Grades/RoundGrades.java b/Grades/RoundGrades.java new file mode 100644 index 0000000..e67e790 --- /dev/null +++ b/Grades/RoundGrades.java @@ -0,0 +1,35 @@ +package Grades; + +import java.util.ArrayList; +import java.util.List; + +public class RoundGrades { + public static void main(String[] args) { + + List notes = new ArrayList<>(); + + notes.add(34); + notes.add(39); + notes.add(54); + notes.add(99); + notes.add(29); + notes.add(88); + System.out.println(studentsGrades(notes)); + + } + + public static List studentsGrades(List grades) { + + List results = new ArrayList<>(); + for (int grade : grades) { + if (grade < 38) { + results.add(grade); + } else { + int remainder = grade % 5; + int roundNum = grade + 5 - remainder; + results.add(roundNum - grade < 3 ? roundNum : grade); + } + } + return results; + } +} diff --git a/Min_Max/.idea/.gitignore b/Min_Max/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Min_Max/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Min_Max/.idea/aws.xml b/Min_Max/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/Min_Max/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/Min_Max/.idea/codeStyles/Project.xml b/Min_Max/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/Min_Max/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/Min_Max/.idea/codeStyles/codeStyleConfig.xml b/Min_Max/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/Min_Max/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Min_Max/.idea/misc.xml b/Min_Max/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/Min_Max/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Min_Max/.idea/modules.xml b/Min_Max/.idea/modules.xml new file mode 100644 index 0000000..fdb9301 --- /dev/null +++ b/Min_Max/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Min_Max/.idea/vcs.xml b/Min_Max/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Min_Max/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Min_Max/MinMaxSum.class b/Min_Max/MinMaxSum.class new file mode 100644 index 0000000000000000000000000000000000000000..1fd10f29a6f86c28fac5e5d3ca5690f207d2e995 GIT binary patch literal 1410 zcmaJ>O>+}R5PhT7YP9RcUs%E>7-KL&l8r?O*a>osBP9-UBupa5sgw_?u{>ojUhS&1 zvy^>;1Njd*=aO5h!T~6t_yPF?`5n2Xa=_`)npiHovQ;}XJ^QBn_3P>VfLAIhd;NG-U&s}>oITz;J+%`nsjMauPxji&H@*|A`w zkHc|r2K~ppH1nGv-@Fv>CJ;5JMPj=CHi=3}n_d|J7zz^P>w> z4gwXbj%e4V+6lJ8ffT;7aSv6F6)nZr3{yw7as5ZZt}MnW$LcJLrV2Xy3_tf~bO?-{ z-V^?oC&Q^)5bQ?n(ndr1P2B)f< zrs9b(lp)6hhN~x%JB>5Pw+t8mA4&}yCx}UEj70a=8lXFg6pagHkJHR(HVZGney0V) zXEf^1dbF@eKZY0@!9bFBXI_K<@C?=qx)JF&cHLMUPyd3!nepl87+!s9uwM`Unt6#V znHRLjMAzeGq-kxTk1qZIjafJpybo8 arr = new ArrayList<>(); + for (int i = 0; i < 5; i++) { + arr.add(sc.nextInt()); + } + + sumMinMax(arr); + sc.close(); + + sumMinMax(arr); + } + + public static void sumMinMax(List arr) { + Collections.sort(arr); + + long minSum = 0; + long maxSum = 0; + + for (int i = 0; i < arr.size() - 1; i++) { + minSum += arr.get(i); + } + + for (int i = 1; i < arr.size(); i++) { + maxSum += arr.get(i); + } + + System.out.println(minSum + " " + maxSum); + } +} diff --git a/Min_Max/Min_Max.iml b/Min_Max/Min_Max.iml new file mode 100644 index 0000000..6521780 --- /dev/null +++ b/Min_Max/Min_Max.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Min_Max/out/production/Min_Max/Min_Max/.idea/.gitignore b/Min_Max/out/production/Min_Max/Min_Max/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Min_Max/out/production/Min_Max/Min_Max/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Min_Max/out/production/Min_Max/Min_Max/.idea/aws.xml b/Min_Max/out/production/Min_Max/Min_Max/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/Min_Max/out/production/Min_Max/Min_Max/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/Min_Max/out/production/Min_Max/Min_Max/.idea/codeStyles/Project.xml b/Min_Max/out/production/Min_Max/Min_Max/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/Min_Max/out/production/Min_Max/Min_Max/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/Min_Max/out/production/Min_Max/Min_Max/.idea/codeStyles/codeStyleConfig.xml b/Min_Max/out/production/Min_Max/Min_Max/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/Min_Max/out/production/Min_Max/Min_Max/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Min_Max/out/production/Min_Max/Min_Max/.idea/misc.xml b/Min_Max/out/production/Min_Max/Min_Max/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/Min_Max/out/production/Min_Max/Min_Max/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Min_Max/out/production/Min_Max/Min_Max/.idea/modules.xml b/Min_Max/out/production/Min_Max/Min_Max/.idea/modules.xml new file mode 100644 index 0000000..fdb9301 --- /dev/null +++ b/Min_Max/out/production/Min_Max/Min_Max/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Min_Max/out/production/Min_Max/Min_Max/.idea/vcs.xml b/Min_Max/out/production/Min_Max/Min_Max/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Min_Max/out/production/Min_Max/Min_Max/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Min_Max/out/production/Min_Max/Min_Max/MinMaxSum.class b/Min_Max/out/production/Min_Max/Min_Max/MinMaxSum.class new file mode 100644 index 0000000000000000000000000000000000000000..8a3464f3c92d31fc3242efa3dc9bc21e7e2c2e53 GIT binary patch literal 2080 zcmaJ?TUQ%Z7~LngfiUITaFqfTYM@BaR@8AQR^X@hJndUoSCqS&-Fj} z+!vqQ2cYd*E}#1&Tt52~TrPBi)>-7osCA*|~-Q%zLj9)X_Y#MfL`?&eL; zPof)96{1&1ANmC}+j!{bY$7M%ToQvA((sm!VVpaH9@Iw@qhh#p*pXJ~ z!6KcVx^jLc*lm|qO-;MmT}wKa@u@&xRc;&0j$M-eUDMy>%=4w~6JT%p=FKqSbT;h@ zGhfH&8gA&w;pUO*Y?@F4s#a6!EY($E;+r8RS6S_{Q#J%T@}_Ovs#iA*_m14KxYM0? zO43@DuBq0|&6vMw5>ik84TZ7{Rh6oLd(-Qo_6VgCrhv%NPP!Ep$2oK?ykTuVTqfDji5KAUA7EwJnuN$^;$N> zLQ|g5&I!jmw!y`6YwJIA&i!TYHMueIA+@=w92$*+O(-xaBeWrZ4Uxb%23q7>VHSqp0}x z-@m30Fv0DMYE&s>LCOmZ4Ycv6qle#vL9`>yaRyzyuDUUYv$%p(0BMRoDGcB%6bXR< za0g!p-m_T6UBc_3?>AUuIrq4)N@(n?bLU&`bRcqwlm<=1sQ4TGOwNmzFIksp2?zqp zQwNx7U2I*7&c##lsb{#vqgsB9p^>Rn{2AsV_#K0Lxbm}Hd=zJ8f5eXMXf^h_)ly*f z=TlrA8GDXvz#cw3CSZo8gGgd5J%J&zKg`uRq8i351zf;+azDlbCs3lCN}J0>+Qzja zB92S^&@^Vm9+aTP#L8#{WTt!+HF`{Rkv| ZHiB7+aaCUk82oRe%2kpx8#TBX_z!l1?708{ literal 0 HcmV?d00001 diff --git a/Min_Max/out/production/Min_Max/Min_Max/Min_Max.iml b/Min_Max/out/production/Min_Max/Min_Max/Min_Max.iml new file mode 100644 index 0000000..6521780 --- /dev/null +++ b/Min_Max/out/production/Min_Max/Min_Max/Min_Max.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ParenthesesBalance/ParenthesesBalance.java b/ParenthesesBalance/ParenthesesBalance.java new file mode 100644 index 0000000..e69de29 diff --git a/PerfectNumber/ThePerfectNumber.class b/PerfectNumber/ThePerfectNumber.class new file mode 100644 index 0000000000000000000000000000000000000000..b6dcaba659aa74901cd0c47b0f10fae9bee2684c GIT binary patch literal 1282 zcmaJ>+fEZv6kVq?)6S@k(MO0mq~Wsm8=ZIlxFe({u(CeA0w( zFzS=h2VQ*92Q|j<0mfJV!VfUS+n$+5Q5uuUx$d?1T6^|BAAh{x0&oFmbwr?Ws0nC@ zG8lKoJ&`L5dpTz=+?6GdAv$5%mUo^(85*9`5ks6qPhbxcWInqhuglsJ8D3kfEXW!| z+;ZzD4C>I-@Xa`yk>oHEXhG{=5enB6 z3LOlc6|pKO9lIpFdCOa&mFo%Ha|ug~?a1AC5sBGSN= zV~`(xYcMtUpGqMM9jM8_x&bBy`v$}#l+ z`InY`&smkZFfU;SuZWW8)Ycgu@049P44qyT_F`GO{nL)Kx>n8a*0l+ zDLbsL{La5tcQGl-<$~qOd<;h^0W52|S&^-VRhG4bGK=9jLsxKh&79qJ&5)R~ZCRTv z3)ht{$2h~lu52_C$#I&Y_y4BU5@ANLpSmGJ1qvusCDcGP_R_A0W=6Ai=q=bQS}^RR z(ZBZBabyV^ntp~#=fFc_&j-DzXl7B3nMKWrn#HJ*G>hEmG>b7KZ5EBF(MKaUPSO}_ zVe>S_TjGys(v6HcJu)-8bzT`)Q)S0s0t8`-TH- z8;P%k(f#+KE^&!`DTEnRCe(A8v{rtBwsfZY6udigXJR8l(Z6)3pMk5JP?eXzd8C8H zG!v^Nc{AwwXraPRQZu&)9Ganhhsv0-4J~$&o)H`jutON8*~c9s21kPN7*5ccPWzKM Ig)`{-1x9Zx$^ZZW literal 0 HcmV?d00001 diff --git a/PerfectNumber/ThePerfectNumber.java b/PerfectNumber/ThePerfectNumber.java new file mode 100644 index 0000000..956df1e --- /dev/null +++ b/PerfectNumber/ThePerfectNumber.java @@ -0,0 +1,22 @@ +public class ThePerfectNumber { + public static void main(String[] args) { + int[] randNums = { 2, 5, 6, 15, 23, 26, 34, 53, 343, 2454, 28 }; + for (int number : randNums) { + if (isPerfect(number)) { + System.out.println(number + " is a perfect number"); + } else { + System.out.println(number + " is NOT a perfect number"); + } + } + } + + private static boolean isPerfect(int num) { + int total = 0; + for (int i = 1; i <= num / 2; i++) { + if (num % i == 0) { + total += i; + } + } + return total == num; + } +} diff --git a/ReverseIntegers/.idea/.gitignore b/ReverseIntegers/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/ReverseIntegers/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/ReverseIntegers/.idea/aws.xml b/ReverseIntegers/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/ReverseIntegers/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/.idea/codeStyles/Project.xml b/ReverseIntegers/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/ReverseIntegers/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml b/ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/ReverseIntegers/.idea/misc.xml b/ReverseIntegers/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/ReverseIntegers/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/.idea/modules.xml b/ReverseIntegers/.idea/modules.xml new file mode 100644 index 0000000..9277611 --- /dev/null +++ b/ReverseIntegers/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/.idea/vcs.xml b/ReverseIntegers/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ReverseIntegers/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/ReverseIntegers.class b/ReverseIntegers/ReverseIntegers.class new file mode 100644 index 0000000000000000000000000000000000000000..24f56b83478a4398cb9579e89a4cb8662497ddbe GIT binary patch literal 694 zcmZuv%Wl&^6g}5YJB{nq4(TI}Q$kAt8wCD0dm`BJ*4$L8Vq zr6f4JiIRK8s4uhUaX;luCCcN$tH<%=A})<$J&RTU#jmSQhs~o%)Ud6AtY} + + + + + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/ReverseIntegers.java b/ReverseIntegers/ReverseIntegers.java new file mode 100644 index 0000000..cff1071 --- /dev/null +++ b/ReverseIntegers/ReverseIntegers.java @@ -0,0 +1,26 @@ +package ReverseIntegers; + +import java.util.Scanner; + +public class ReverseIntegers { + public static int reverseInt() { + int revInt = 0, remainderInt = 0; + Scanner sc = new Scanner(System.in); + + System.out.print( "Please enter a number => "); + int a = sc.nextInt(); + + while (a != 0) { + remainderInt = a % 10; + revInt *= 10; + revInt += remainderInt; + a /= 10; + } + return revInt; + } + + public static void main(String[] args) { + + System.out.println(reverseInt()); + } +} diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/.gitignore b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/aws.xml b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/codeStyles/Project.xml b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/misc.xml b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/modules.xml b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/modules.xml new file mode 100644 index 0000000..9277611 --- /dev/null +++ b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/vcs.xml b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/ReverseIntegers.class b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/ReverseIntegers.class new file mode 100644 index 0000000000000000000000000000000000000000..a83cf5709f6a1deacfa4befbf3abe4bd6d513402 GIT binary patch literal 1043 zcmZuw-A)rh6#iygSXdS)l)n~`qM~g@>c8lg-k6v)DN3wqV!UxEld`zoHrp-HNAU@~ z@kTDdVB!P#CccFD%~Av!Zf4Fo^PO|P^E1Ey9{&Qcfei}=VkY7?1~4d)*pvIR;7Pwx zc)h)+>Y>13(e>T1BoNEyY9@vRCL&NbbiG2gE`47G!>}-7!nQGru}e{^pF5#y3K*_0 zFkOi}-BzLOx4U6A43um-7EB~`{t1D(?3IvQO=n2jn8GxPw7TSV9&9Uc{j*?0m=#EE zc}jLvM){!%GBV?Lo7)sNN*N0&q)p7*Siqt{@{G@g5CQ{j9grD%WTJMEtm`+NTuswm zvXQ~Efa$AGVOe9@oU(-*xM^a=#x4E0^hWKgpriP%8WakBx_}k@M`&VM8#&||HOlX? zVexD^SL5}fwW9>aE3U6zMYX(@+a4{Gl~!GPH5s^C?-}FauG4ekDIc6mR0)-%w*r6x?FA=Ymh;Mtddte zvk}!+H>j(Zt}be-kN27$5|-IqgF6evz!71P=N)PV-h%f){s`hb1p})*^)rpQ%hT@3 zYXk$sdOEad=VJzo^InfRvEomd?+!40gz?P-Ois=mVs7;i*Gh|DkXlSw?P5A%?KWf79(7-QLf1tR%pp1fi+Cv36c?~Jdp;qd$>=( zI3D2vCC->D@Q|88?*%-jEk+dRZJf{$7s7v|c_;J_ V2j+-RUFe2|XLwG#fWy;3@gGzB*%tr+ literal 0 HcmV?d00001 diff --git a/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/ReverseIntegers.iml b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/ReverseIntegers.iml new file mode 100644 index 0000000..b5236e6 --- /dev/null +++ b/ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/ReverseIntegers.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/StairCase/StairCase.class b/StairCase/StairCase.class new file mode 100644 index 0000000000000000000000000000000000000000..ee950e7eb692ad72a261d47b2fb0be49c4562520 GIT binary patch literal 792 zcmZuvO>fgc5Pg%_StoVVHYK4zLi)i+l0r-i6r@5pv_eEG6v?O(;^Y{sa&b11;~=>A zcW{71&h(H9koW=I_z(Pw3N_3c3PkE2c6Mjp%zHbt-;O_j1@HiOGDsjPpqbE-B24c& zuN^CJW@y`(EDyKrKI|?*w;tcWxA-y+IQ?fRe)KuJO zP0ZmO-#dNw{-b#s`tpRvzy$)$8z`|^%AkySfdvzbSR%}x2>UOCpm$Y17yP3t?hC8- zz2iN6#504qm|_iKDBu_d;8?GW^l4}|Nyt1ys68g*EFR?ts;*V#6|Ks-M{`jDTv zJVfq(u~B-56>Uw+YsC*J9-xrdO7CIh&JUpHibGu7*Jv>M!GR$z?I%Zr(RWU~s^}6i zU5!VqNGH@!fq?=Om)W<<_AX2`*tdx+9$^YM7+FW^7&!q!^phuH3zSE!QWsc>o%|iy RC2;cy#t~N~+>W`{egUuSq)-3= literal 0 HcmV?d00001 diff --git a/StairCase/StairCase.java b/StairCase/StairCase.java new file mode 100644 index 0000000..742575c --- /dev/null +++ b/StairCase/StairCase.java @@ -0,0 +1,16 @@ +import java.util.Scanner; + +public class StairCase { + public static void main(String[] args) { + + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + for (int i = n; i > 0; i--) { + for (int k = 1; k <= n; k++) { + System.out.print(k < i ? " " : "#"); + } + System.out.println(); + } + sc.close(); + } +} diff --git a/SubString/.gitignore b/SubString/.gitignore new file mode 100644 index 0000000..5ded944 --- /dev/null +++ b/SubString/.gitignore @@ -0,0 +1,3 @@ +out +SubString.iml +.idea diff --git a/SubString/SubString.java b/SubString/SubString.java new file mode 100644 index 0000000..93f06c9 --- /dev/null +++ b/SubString/SubString.java @@ -0,0 +1,25 @@ +package SubString; + +import java.util.Scanner; + +public class SubString { + public static void main(String[] args) { + + System.out.println(subString()); + } + + private static String subString() { + Scanner sc = new Scanner(System.in); + String str = sc.next(); + int start = sc.nextInt(); + int end = sc.nextInt(); + char[] ltrs = str.toCharArray(); + String subStr = ""; + + for (int i = start; i < end; i++) { + subStr += Character.toString(ltrs[i]); + } + sc.close(); + return subStr; + } +} diff --git a/TallestCandle/.idea/.gitignore b/TallestCandle/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/TallestCandle/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/TallestCandle/.idea/aws.xml b/TallestCandle/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/TallestCandle/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/TallestCandle/.idea/codeStyles/Project.xml b/TallestCandle/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..919ce1f --- /dev/null +++ b/TallestCandle/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/TallestCandle/.idea/codeStyles/codeStyleConfig.xml b/TallestCandle/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/TallestCandle/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/TallestCandle/.idea/misc.xml b/TallestCandle/.idea/misc.xml new file mode 100644 index 0000000..3d3ab27 --- /dev/null +++ b/TallestCandle/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TallestCandle/.idea/modules.xml b/TallestCandle/.idea/modules.xml new file mode 100644 index 0000000..840e4db --- /dev/null +++ b/TallestCandle/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/TallestCandle/.idea/vcs.xml b/TallestCandle/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/TallestCandle/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TallestCandle/TallestCandles.class b/TallestCandle/TallestCandles.class new file mode 100644 index 0000000000000000000000000000000000000000..743025035dc7fff6d35bc509f7f00d6a3434d95c GIT binary patch literal 1223 zcmZuw-%}D%6#gzC3(Kk~LYkmyzZOX7msWz5Sr$cDgF|Ugt8BCei?b|F_UymVLvKyf zj4!?9gG$XbJ@-%4-{CacxhsxKH9K?9x#xcOoNvE#&yW2t-vHdi0}&251-K-1z|G)a zQPz}XMbXR2xuq3#*<^61HC;0^3{E*(6yRY9SfGZfRg%+&p{(b$x+y|{Q-lwafKCZr z=w|3SPL|b8wX7Np!kSWPsB!_G1bJT1l-x42%N=HkiG zMSkOogsT{*g1Qy%JIZZqJaPBonuP1P!FlLrkvGmtk>wOq64Lz0RoC9AJdly-J>4Qe zS><}Pcem9dg3r`Sl%+eT>1w`FT~dvCWvN0DS5?tSf{^^&)>)EK)61!7k)g9-D$B1P zDXT5Kx1g1E#cUXKSN^+kXQ z1+CMxi;!hxJ7POvpUGjkO)Ed7eNV-Ts3hdwU?0oY{SVm4}OL}QD%oFPlEV>M%jTNT%_zM`XOTgabl7nO(%)*LkuHN{yd%D hC3FbxefSs?FgCmg$8Rte*(0{IR@QqY@_oz8{sF6j2J8R; literal 0 HcmV?d00001 diff --git a/TallestCandle/TallestCandles.java b/TallestCandle/TallestCandles.java new file mode 100644 index 0000000..cb386e4 --- /dev/null +++ b/TallestCandle/TallestCandles.java @@ -0,0 +1,39 @@ +package TallestCandle; + +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public class TallestCandles { + public static void main(String[] args) { + List nums = new ArrayList<>(); + Scanner sc = new Scanner(System.in); + + System.out.println("How old are you?"); + int n = sc.nextInt(); + for (int i = 0; i < n; i++) { + nums.add(sc.nextInt()); + } + int x = tallestCandles(nums); + System.out.println(x); + sc.close(); + } + + public static int tallestCandles(List candles) { + int tallestCandle = 0; + int sumofTallestCandles = 0; + + for (int num : candles) { + if (num > tallestCandle) { + tallestCandle = num; + } + } + + for (int i = 0; i < candles.size(); i++) { + if (candles.get(i) == tallestCandle) { + sumofTallestCandles++; + } + } + return sumofTallestCandles; + } +} diff --git a/smallString/failedTest.java b/smallString/failedTest.java new file mode 100644 index 0000000..c86d64c --- /dev/null +++ b/smallString/failedTest.java @@ -0,0 +1,32 @@ +import java.util.HashMap; +import java.util.Map; + +public class failedTest { + public static int getAnagramPeriod(String input_str) { + int len = input_str.length(); + Map freqMap = new HashMap<>(); + + // Count the frequency of each character in the input string + for (char c : input_str.toCharArray()) { + freqMap.put(c, freqMap.getOrDefault(c, 0) + 1); + } + + int period = freqMap.size(); // Anagram period initially equals the count of unique characters + + return period; + } + + public static int getSmallestPossibleStringLength(String input_str) { + int period = getAnagramPeriod(input_str); + int len = input_str.length(); + + return len / period; + } + + public static void main(String[] args) { + String input = "abbbabbabababbbbbaaaaaaababa"; // Replace this with your input string + int smallestLength = getSmallestPossibleStringLength(input); + System.out.println("The length of the smallest possible string is: " + smallestLength); + } +} +