adding old solved challenges
This commit is contained in:
parent
fa5ac5e089
commit
7ecd444efb
BIN
AnagramPeriod/AnagramPeriod.class
Normal file
BIN
AnagramPeriod/AnagramPeriod.class
Normal file
Binary file not shown.
12
AnagramPeriod/AnagramPeriod.java
Normal file
12
AnagramPeriod/AnagramPeriod.java
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
public class AnagramPeriod {
|
||||
|
||||
public static void main(String[] args) {
|
||||
getAnagramPeriod("ababbaab");
|
||||
}
|
||||
|
||||
private static void getAnagramPeriod(String input_str) {
|
||||
int n = input_str.length();
|
||||
System.out.println(n);
|
||||
}
|
||||
}
|
||||
3
AngryProfessor/.idea/.gitignore
vendored
Normal file
3
AngryProfessor/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
11
AngryProfessor/.idea/aws.xml
Normal file
11
AngryProfessor/.idea/aws.xml
Normal 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
AngryProfessor/.idea/codeStyles/Project.xml
Normal file
7
AngryProfessor/.idea/codeStyles/Project.xml
Normal 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
AngryProfessor/.idea/codeStyles/codeStyleConfig.xml
Normal file
5
AngryProfessor/.idea/codeStyles/codeStyleConfig.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
||||
6
AngryProfessor/.idea/misc.xml
Normal file
6
AngryProfessor/.idea/misc.xml
Normal 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
AngryProfessor/.idea/modules.xml
Normal file
8
AngryProfessor/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/AngryProfessor.iml" filepath="$PROJECT_DIR$/AngryProfessor.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
AngryProfessor/.idea/vcs.xml
Normal file
6
AngryProfessor/.idea/vcs.xml
Normal 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>
|
||||
BIN
AngryProfessor/AngryProf.class
Normal file
BIN
AngryProfessor/AngryProf.class
Normal file
Binary file not shown.
32
AngryProfessor/AngryProf.java
Normal file
32
AngryProfessor/AngryProf.java
Normal file
@ -0,0 +1,32 @@
|
||||
package AngryProfessor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AngryProf {
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<Integer> 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<Integer> a) {
|
||||
|
||||
int numOnTime = 0;
|
||||
for (int x : a) {
|
||||
if (x <= 0) {
|
||||
numOnTime++;
|
||||
}
|
||||
}
|
||||
if (numOnTime > k) {
|
||||
return "No";
|
||||
}
|
||||
return "Yes";
|
||||
}
|
||||
}
|
||||
11
AngryProfessor/AngryProfessor.iml
Normal file
11
AngryProfessor/AngryProfessor.iml
Normal 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" packagePrefix="AngryProfessor" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
3
AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/.gitignore
vendored
Normal file
3
AngryProfessor/out/production/AngryProfessor/AngryProfessor/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
@ -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>
|
||||
@ -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$/AngryProfessor.iml" filepath="$PROJECT_DIR$/AngryProfessor.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -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.
@ -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" packagePrefix="AngryProfessor" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
1
ArraySum
Submodule
1
ArraySum
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit db216c988bb8fc331e1863e125a1db09d37b4fff
|
||||
1
BasketBallRecords
Submodule
1
BasketBallRecords
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit fd9140c61f6c82b92d743303898489974ae29830
|
||||
11
BeautifulDay/BeautifulDay.iml
Normal file
11
BeautifulDay/BeautifulDay.iml
Normal 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
BeautifulDay/BeautifulDays.java
Normal file
50
BeautifulDay/BeautifulDays.java
Normal 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 ;
|
||||
*/
|
||||
|
||||
}
|
||||
3
BeautifulDay/out/production/BeautifulDay/.idea/.gitignore
vendored
Normal file
3
BeautifulDay/out/production/BeautifulDay/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
11
BeautifulDay/out/production/BeautifulDay/.idea/aws.xml
Normal file
11
BeautifulDay/out/production/BeautifulDay/.idea/aws.xml
Normal 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
BeautifulDay/out/production/BeautifulDay/.idea/misc.xml
Normal file
6
BeautifulDay/out/production/BeautifulDay/.idea/misc.xml
Normal 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
BeautifulDay/out/production/BeautifulDay/.idea/vcs.xml
Normal file
6
BeautifulDay/out/production/BeautifulDay/.idea/vcs.xml
Normal 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>
|
||||
11
BeautifulDay/out/production/BeautifulDay/BeautifulDay.iml
Normal file
11
BeautifulDay/out/production/BeautifulDay/BeautifulDay.iml
Normal 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>
|
||||
BIN
BeautifulDay/out/production/BeautifulDay/BeautifulDays.class
Normal file
BIN
BeautifulDay/out/production/BeautifulDay/BeautifulDays.class
Normal file
Binary file not shown.
BIN
BinarySearch/BinarySearch.class
Normal file
BIN
BinarySearch/BinarySearch.class
Normal file
Binary file not shown.
42
BinarySearch/BinarySearch.java
Normal file
42
BinarySearch/BinarySearch.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
BIN
BirdsMigration/BirdsMigration.class
Normal file
BIN
BirdsMigration/BirdsMigration.class
Normal file
Binary file not shown.
35
BirdsMigration/BirdsMigration.java
Normal file
35
BirdsMigration/BirdsMigration.java
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BirdsMigration {
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<Integer> 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<Integer> 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;
|
||||
}
|
||||
}
|
||||
35
BirdsMigration/\
Normal file
35
BirdsMigration/\
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BirdsMigration {
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<Integer> 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<Integer> 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;
|
||||
}
|
||||
}
|
||||
96
BobConundrum/.idea/workspace.xml
Normal file
96
BobConundrum/.idea/workspace.xml
Normal file
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="6a836e97-f059-4118-a4a0-e9b7b098ea99" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/aws.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/codeStyles/Project.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/.idea/.gitignore" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/.idea/aws.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/.idea/codeStyles/Project.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/.idea/codeStyles/codeStyleConfig.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/.idea/misc.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/.idea/modules.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/.idea/vcs.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/BobConundrum.iml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/BobConundrum/BobConundrum/BobConundrumSolution.class" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../fibonacciSQ.java" beforeDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="CodeStyleSettingsInfer">
|
||||
<option name="done" value="true" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectCodeStyleSettingsMigration">
|
||||
<option name="version" value="2" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2bpVKuzfFLmqaBBGOCQI3NxAqS5" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="project.structure.last.edited" value="Project" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.2" />
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="BobConundrumSolution" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="BobConundrum.BobConundrumSolution" />
|
||||
<module name="BobConundrum" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="BobConundrum.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.BobConundrumSolution" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="6a836e97-f059-4118-a4a0-e9b7b098ea99" name="Changes" comment="" />
|
||||
<created>1706911947169</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1706911947169</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
11
BobConundrum/BobConundrum.iml
Normal file
11
BobConundrum/BobConundrum.iml
Normal 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" packagePrefix="BobConundrum" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
BIN
BobConundrum/BobConundrumSolution.class
Normal file
BIN
BobConundrum/BobConundrumSolution.class
Normal file
Binary file not shown.
0
BobConundrum/BobConundrumSolution.java
Normal file
0
BobConundrum/BobConundrumSolution.java
Normal file
2
Grades/.gitignore
vendored
Normal file
2
Grades/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
RoundGrades.class
|
||||
Grades.iml
|
||||
3
Grades/.idea/.gitignore
vendored
Normal file
3
Grades/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
11
Grades/.idea/aws.xml
Normal file
11
Grades/.idea/aws.xml
Normal 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
Grades/.idea/codeStyles/Project.xml
Normal file
7
Grades/.idea/codeStyles/Project.xml
Normal 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
Grades/.idea/codeStyles/codeStyleConfig.xml
Normal file
5
Grades/.idea/codeStyles/codeStyleConfig.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
||||
6
Grades/.idea/misc.xml
Normal file
6
Grades/.idea/misc.xml
Normal 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
Grades/.idea/modules.xml
Normal file
8
Grades/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Grades.iml" filepath="$PROJECT_DIR$/Grades.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
Grades/.idea/vcs.xml
Normal file
6
Grades/.idea/vcs.xml
Normal 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>
|
||||
35
Grades/RoundGrades.java
Normal file
35
Grades/RoundGrades.java
Normal file
@ -0,0 +1,35 @@
|
||||
package Grades;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RoundGrades {
|
||||
public static void main(String[] args) {
|
||||
|
||||
List<Integer> 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<Integer> studentsGrades(List<Integer> grades) {
|
||||
|
||||
List<Integer> 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;
|
||||
}
|
||||
}
|
||||
3
Min_Max/.idea/.gitignore
vendored
Normal file
3
Min_Max/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
11
Min_Max/.idea/aws.xml
Normal file
11
Min_Max/.idea/aws.xml
Normal 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
Min_Max/.idea/codeStyles/Project.xml
Normal file
7
Min_Max/.idea/codeStyles/Project.xml
Normal 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
Min_Max/.idea/codeStyles/codeStyleConfig.xml
Normal file
5
Min_Max/.idea/codeStyles/codeStyleConfig.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
||||
6
Min_Max/.idea/misc.xml
Normal file
6
Min_Max/.idea/misc.xml
Normal 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
Min_Max/.idea/modules.xml
Normal file
8
Min_Max/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Min_Max.iml" filepath="$PROJECT_DIR$/Min_Max.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
Min_Max/.idea/vcs.xml
Normal file
6
Min_Max/.idea/vcs.xml
Normal 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>
|
||||
BIN
Min_Max/MinMaxSum.class
Normal file
BIN
Min_Max/MinMaxSum.class
Normal file
Binary file not shown.
39
Min_Max/MinMaxSum.java
Normal file
39
Min_Max/MinMaxSum.java
Normal file
@ -0,0 +1,39 @@
|
||||
package Min_Max;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class MinMaxSum {
|
||||
public static void main(String[] args) {
|
||||
|
||||
Scanner sc = new Scanner(System.in);
|
||||
List<Integer> 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<Integer> 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);
|
||||
}
|
||||
}
|
||||
11
Min_Max/Min_Max.iml
Normal file
11
Min_Max/Min_Max.iml
Normal 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" packagePrefix="Min_Max" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
3
Min_Max/out/production/Min_Max/Min_Max/.idea/.gitignore
vendored
Normal file
3
Min_Max/out/production/Min_Max/Min_Max/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
11
Min_Max/out/production/Min_Max/Min_Max/.idea/aws.xml
Normal file
11
Min_Max/out/production/Min_Max/Min_Max/.idea/aws.xml
Normal 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
Min_Max/out/production/Min_Max/Min_Max/.idea/misc.xml
Normal file
6
Min_Max/out/production/Min_Max/Min_Max/.idea/misc.xml
Normal 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
Min_Max/out/production/Min_Max/Min_Max/.idea/modules.xml
Normal file
8
Min_Max/out/production/Min_Max/Min_Max/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Min_Max.iml" filepath="$PROJECT_DIR$/Min_Max.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
Min_Max/out/production/Min_Max/Min_Max/.idea/vcs.xml
Normal file
6
Min_Max/out/production/Min_Max/Min_Max/.idea/vcs.xml
Normal 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>
|
||||
BIN
Min_Max/out/production/Min_Max/Min_Max/MinMaxSum.class
Normal file
BIN
Min_Max/out/production/Min_Max/Min_Max/MinMaxSum.class
Normal file
Binary file not shown.
11
Min_Max/out/production/Min_Max/Min_Max/Min_Max.iml
Normal file
11
Min_Max/out/production/Min_Max/Min_Max/Min_Max.iml
Normal 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" packagePrefix="Min_Max" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
0
ParenthesesBalance/ParenthesesBalance.java
Normal file
0
ParenthesesBalance/ParenthesesBalance.java
Normal file
BIN
PerfectNumber/ThePerfectNumber.class
Normal file
BIN
PerfectNumber/ThePerfectNumber.class
Normal file
Binary file not shown.
22
PerfectNumber/ThePerfectNumber.java
Normal file
22
PerfectNumber/ThePerfectNumber.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
3
ReverseIntegers/.idea/.gitignore
vendored
Normal file
3
ReverseIntegers/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
11
ReverseIntegers/.idea/aws.xml
Normal file
11
ReverseIntegers/.idea/aws.xml
Normal 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
ReverseIntegers/.idea/codeStyles/Project.xml
Normal file
7
ReverseIntegers/.idea/codeStyles/Project.xml
Normal 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
ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml
Normal file
5
ReverseIntegers/.idea/codeStyles/codeStyleConfig.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
||||
6
ReverseIntegers/.idea/misc.xml
Normal file
6
ReverseIntegers/.idea/misc.xml
Normal 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
ReverseIntegers/.idea/modules.xml
Normal file
8
ReverseIntegers/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/ReverseIntegers.iml" filepath="$PROJECT_DIR$/ReverseIntegers.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
ReverseIntegers/.idea/vcs.xml
Normal file
6
ReverseIntegers/.idea/vcs.xml
Normal 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>
|
||||
BIN
ReverseIntegers/ReverseIntegers.class
Normal file
BIN
ReverseIntegers/ReverseIntegers.class
Normal file
Binary file not shown.
11
ReverseIntegers/ReverseIntegers.iml
Normal file
11
ReverseIntegers/ReverseIntegers.iml
Normal 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" packagePrefix="ReverseIntegers" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
26
ReverseIntegers/ReverseIntegers.java
Normal file
26
ReverseIntegers/ReverseIntegers.java
Normal file
@ -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());
|
||||
}
|
||||
}
|
||||
3
ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/.gitignore
vendored
Normal file
3
ReverseIntegers/out/production/ReverseIntegers/ReverseIntegers/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
@ -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>
|
||||
@ -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$/ReverseIntegers.iml" filepath="$PROJECT_DIR$/ReverseIntegers.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -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.
@ -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" packagePrefix="ReverseIntegers" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
BIN
StairCase/StairCase.class
Normal file
BIN
StairCase/StairCase.class
Normal file
Binary file not shown.
16
StairCase/StairCase.java
Normal file
16
StairCase/StairCase.java
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
3
SubString/.gitignore
vendored
Normal file
3
SubString/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
out
|
||||
SubString.iml
|
||||
.idea
|
||||
25
SubString/SubString.java
Normal file
25
SubString/SubString.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
3
TallestCandle/.idea/.gitignore
vendored
Normal file
3
TallestCandle/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
11
TallestCandle/.idea/aws.xml
Normal file
11
TallestCandle/.idea/aws.xml
Normal 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
TallestCandle/.idea/codeStyles/Project.xml
Normal file
7
TallestCandle/.idea/codeStyles/Project.xml
Normal 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>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user