This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Connect to the host's server using the mounted UNIX socket | |
default-server = unix:/run/user/1001/pulse/native | |
# Prevent a server running in the container | |
autospawn = no | |
daemon-binary = /bin/true | |
# Prevent the use of shared memory | |
enable-shm = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Connect to the host's server using the mounted UNIX socket | |
default-server = unix:/run/user/1000/pulse/native | |
# Prevent a server running in the container | |
autospawn = no | |
daemon-binary = /bin/true | |
# Prevent the use of shared memory | |
enable-shm = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: '3.3' | |
# More details here https://github.com/GioF71/squeezelite-docker | |
# This stack configures three players on dac 'x20' and two players on dac 'DAC' | |
# lms.homelab.com is where my logitech media server is. | |
# Change the SQUEEZELITE_SERVER_PORT value according to your network configuration | |
# Remember to specify SQUEEZELITE_SERVER_PORT or discovery will not find all the configured players | |
services: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: '3.3' | |
# More details here https://github.com/GioF71/squeezelite-docker | |
# This stack configures three players on dac 'x20' | |
# lms.homelab.com is where my logitech media server is. | |
# Change the SQUEEZELITE_SERVER_PORT value according to your network configuration | |
# Remember to specify SQUEEZELITE_SERVER_PORT or discovery will not find all the configured players | |
services: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127642310 | |
127642310 | |
127642310 | |
Combinatory: 52.274, Naive: 14.476 msec, NonNaive: 4.410 msec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static long nonNaive(List<Long> values, long sum) { | |
Long result = null; | |
List<Long> sorted = values.stream().filter(x -> x <= (SUM - 2)).collect(Collectors.toList()); | |
sorted.sort(Comparator.naturalOrder()); | |
for (int i = 0; result == null && i < sorted.size() - 2; ++i) { | |
long a = sorted.get(i); | |
boolean offRange = false; | |
for (int j = i; !offRange && result == null && j < sorted.size() - 1; ++j) { | |
long b = sorted.get(j); | |
long partial = a + b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static <T> List<T> readFile( | |
String fileName, | |
Supplier<List<T>> listSupplier, | |
Function<String, T> converter) throws IOException { | |
List<T> list = listSupplier.get(); | |
FileInputStream inputStream = null; | |
try { | |
ClassLoader classLoader = Puzzle01.class.getClassLoader(); | |
File file = new File(classLoader.getResource(fileName).getFile()); | |
inputStream = new FileInputStream(file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given the list of numbers, find the three numbers (a, b, c) that sum to 2020 and return (a*b*c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1322 | |
1211 | |
1427 | |
1428 | |
1953 | |
1220 | |
1629 | |
1186 | |
1354 | |
1776 |