commit adc4bddce67e1d4269f9f8517a21e2d40ca59447 Author: Stephen Seo Date: Fri Jun 5 23:08:53 2020 +0900 Init commit skeleton project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6ffe284 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +src/*.o +2Max diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..57cdd6b --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +CC = gcc +COMMON_FLAGS = -Wall -Wextra -Wpedantic +LINKER_FLAGS = +ifdef DEBUG + CFLAGS = ${COMMON_FLAGS} -g -O0 +else + CFLAGS = ${COMMON_FLAGS} -O3 -DNDEBUG +endif + +all: 2Max + +2Max: src/main.o + ${CC} ${COMMON_FLAGS} ${LINKER_FLAGS} -o 2Max $^ + +clean: + rm -f 2Max + rm -f src/*.o diff --git a/link b/link new file mode 100644 index 0000000..59b7996 --- /dev/null +++ b/link @@ -0,0 +1 @@ +https://programmingpraxis.com/2020/06/05/2max/ diff --git a/problem b/problem new file mode 100644 index 0000000..a2fd750 --- /dev/null +++ b/problem @@ -0,0 +1,12 @@ +Today’s exercise comes from Stack Overflow: + +Given an array A consisting of N integers, return the maximum sum of two numbers +whose digits add up to an equal sum. If there are not two numbers whose digits +have an equal sum, the function should return -1. For example, A = [51, 71, 17, +42] would output 93 because there are two sets of numbers with the same +digit-sum, (51, 42) with a digit-sum of 6 and (17, 71) with a digit-sum of 8, +and the first pair has the maximum sum of two numbers of 93. + +Your task is to write a program to calculated the requested maximum sum. When +you are finished, you are welcome to read or run a suggested solution, or to +post your own solution or discuss the exercise in the comments below. diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..11b7fad --- /dev/null +++ b/src/main.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 0; +}