Init commit skeleton project

This commit is contained in:
Stephen Seo 2020-06-05 23:08:53 +09:00
commit adc4bddce6
5 changed files with 35 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
src/*.o
2Max

17
Makefile Normal file
View file

@ -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

1
link Normal file
View file

@ -0,0 +1 @@
https://programmingpraxis.com/2020/06/05/2max/

12
problem Normal file
View file

@ -0,0 +1,12 @@
Todays 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.

3
src/main.c Normal file
View file

@ -0,0 +1,3 @@
int main(int argc, char **argv) {
return 0;
}