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
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+50
View File
@@ -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 ;
*/
}
@@ -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>
@@ -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>
@@ -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>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/BeautifulDay.iml" filepath="$PROJECT_DIR$/BeautifulDay.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>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>