Day_9
Intro
Q14. alternatingSums
Several people are standing in a row and need to be divided into two teams. The first person goes into team 1, the second goes into team 2, the third goes into team 1 again, the fourth into team 2, and so on.
You are given an array of positive integers - the weights of the people. Return an array of two integers, where the first element is the total weight of team 1, and the second element is the total weight of team 2 after the division is complete.
1 | def alternatingSums(a): |
처음에 리스트로 만들어서 합산을 하려고 했는데, 굳이 리스트 없이 홀수끼리의 합과 짝수끼리의 합을 구해서 배열에 넣고 리턴하면 되는 것이었다. 복잡하게 생각할 필요 없었던 문제
Q15. Add Border
Given a rectangular matrix of characters, add a border of asterisks(*) to it.
1 | def addBorder(picture): |
작성 흐름
1 | # 테스트 케이스 |