Create Git Repo

This commit is contained in:
ChristopherDiesch 2025-03-10 12:35:22 -06:00
commit 3bb124b7ed
10 changed files with 1076 additions and 0 deletions

3
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

10
.idea/Day1.iml generated Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.12 (Day1)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

6
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12 (Day1)" />
</component>
</project>

8
.idea/modules.xml generated Normal file
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$/.idea/Day1.iml" filepath="$PROJECT_DIR$/.idea/Day1.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
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>

11
helper.py Normal file
View File

@ -0,0 +1,11 @@
def load_lists():
list_1 = []
list_2 = []
with open('./input.txt', 'r') as reader:
for l in reader:
ids = l.split(' ')
list_1.append(int(ids[0]))
list_2.append(int(ids[1]))
list_1.sort()
list_2.sort()
return list_1, list_2

1000
input.txt Normal file

File diff suppressed because it is too large Load Diff

9
part1.py Normal file
View File

@ -0,0 +1,9 @@
from helper import load_lists
list_1, list_2 = load_lists()
result = 0
for i in range(len(list_2)):
id_1 = int(list_1.pop(0))
id_2 = int(list_2.pop(0))
result += abs(id_1 - id_2)
print(result)

17
part2.py Normal file
View File

@ -0,0 +1,17 @@
from helper import load_lists
list_1, list_2 = load_lists()
id_counts = {}
for id in list_2:
if id not in id_counts:
id_counts[id] = 1
else:
id_counts[id] += 1
result = 0
for id in list_1:
if id in id_counts:
result += (id * id_counts[id])
print(result)