adding old solved challenges

This commit is contained in:
2024-10-15 11:03:57 -04:00
parent fa5ac5e089
commit 7ecd444efb
107 changed files with 1056 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="accountSettings">
<option name="activeRegion" value="us-east-1" />
<option name="recentlyUsedRegions">
<list>
<option value="us-east-1" />
</list>
</option>
</component>
</project>
+7
View File
@@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>
+5
View File
@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/TallestCandle.iml" filepath="$PROJECT_DIR$/TallestCandle.iml" />
</modules>
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
Binary file not shown.
+39
View File
@@ -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<Integer> 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<Integer> 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;
}
}