26
Advent of Code 2021 Python Solution: Day 7
I found today's solution to be easier than previous day's.
data,data1 = get_data(day=7)
data = [int(d) for d in data[0].split(",")]
data1 = [int(d) for d in data1[0].split(",")]
l = len(data1)
f = []
for v in range(l):
f.append((sum([abs(d-v) for d in data1])))
print(min(f))
min([sum([abs(d-v) for d in data1]) for v in range(len(data1))])
l = len(data1)
f = []
for v in range(l):
diff = [abs(d-v) for d in data1]
diffs = sum([sum(list(range(dif+1))) for dif in diff])
f.append(diffs)
print(min(f))
min([sum([sum(list(range(abs(d-v)+1))) for d in data1]) for v in range(len(data1))])
- Gesture Based Visually Writing System Using OpenCV and Python
- Gesture Based Visually Writing System: Adding Visual User Interface
- Gesture Based Visually Writing System: Adding Virtual Animationn, New Mode and New VUI
- Gesture Based Visually Writing System: Add Slider, More Colors and Optimized OOP code
- Gesture Based Visually Writing System: A Web App
- Contour Based Game: Break The Bricks
- Linear Regression from Scratch
- Writing Popular ML Optimizers from Scratch
- Feed Forward Neural Network from Scratch
- Convolutional Neural Networks from Scratch
- Writing a Simple Image Processing Class from Scratch
- Deploying a RASA Chatbot on Android using Unity3d
- Naive Bayes for text classifications: Scratch to Framework
- Simple OCR for Devanagari Handwritten Text
26