본문 바로가기

전체 글

(424)
Aracade Intro #8 MatrixElementsSum Each cell in the matrix contains an integer that represents the price of them. Some rooms are free(0), because they are haunted. They are not suitable to live in.Calculate the total price of all the rooms that are suitable to live in. 입력받은 2차원 배열(월세 가격)에서 0 인 위치는 귀신이 있는 집이다.가격이 0인 위치와 0의 바로 아랫줄(같은 열) 은 어디든 살기 싫다. 살 수 있는 적합한 방의 배열위치에 있는 모든 가격(정수)의 합을 구하라. e.g. matrix = [[ 1, 3, 4, 0 ], [ 3, 0, 6,..
Aracade Intro #7 AlmostIncreasingSequence %정리하고싶음 Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array. 주어진 정수 배열에서, 오름차순 배열이 되는지 확인해라 (최대 1개까지 삭제 가능) //Process//1. Input integer sequence//2. Check if it's ascending vector or not//3. Check if it's ascending vector after erasing front error number index//4. Check if it's asc..
Aracade Intro #6 MakeArrayConsecutive2 Find the count of additional number needed for consecutive integer vector 입력받은 벡터에서 연속된 숫자 배열이 되기 위해 빠진 숫자의 개수를 출력한다 //Process//1. Input statues vector//2. Get minNum and maxNum//3. distance of min and max - length//4. Return count //처리과정//1. 정수 배열 입력받는다.//2. 정렬한다.//3. 가장 큰수, 가장 작은수의 차이에서 정수 개수를 빼서 빠진 개수를 구한다.//4. 결과를 출력한다. int makeArrayConsecutive2(std::vector statues) { int count = 0; std::sor..
Aracade Intro #5 ShapeArea Rectangle block number of rectangle of input integer size 입력받은 정수 사이즈의 사각형에 들어가는 사각블럭 개수를 출력하라. e.g. //Process//1. Input integer for rectangle size//2. Iterate first line to mid line// 2.1. Count blocks//3. Iterate mid line + 1 to last line// 3.1. Count blocks//4. Return result //처리과정//1. 사각형 사이즈 입력받는다.//2. 첫줄부터 중간까지 반복한다.// 2.1. 블럭 개수를 센다.//3. 중간+1 줄부터 마지막까지 반복한다.// 3.1. 블럭 개수를 센다.//4. 결과 반환한다...
Aracade Intro #4 AdjacentElementsProduct Given an array of integers, find the pair of adjacent elements that has the largest product and return that product. 입력받은 정수배열에서 인접한 두 값의 합이 최대인 값을 반환한다. //Process//1. Input integer array//2. Iterate from begin to the end - 1// 2.1. Get the value of i and i+1 integer// 2.2. Check if it's largest number or not, if so -> change//3. Return largestNumber //처리과정//1. 정수 배열 입력받는다.//2. 시작부터 끝-1 까지 반복한다...
Aracade Intro #3 CheckPalindrome Check if input string is palindrome or not 입력받는 문자가 회문(수박이박수) 인지 확인한다 //Process//1. Input string for checking//2. Iterate from the front char and the rear char are the same && till they meet// 2.1. Update front and rear char//3. Get the answer and output it //처리과정//1. 체크할 문자 입력받는다.//2. 앞에서, 뒤에서 문자 읽어서 같아야 하고, 중간에서 만나기 전까지 반복한다.// 2.1. 체크할 앞 뒤 문자 갱신한다.//3. 끝까지 왔으면 답은 true 로 출력한다. bool checkPalind..
Aracade Intro #2 CenturyFromYear Calculate century from year연도를 입력받고 세기를 계산한다 // Process//1. Input year//2. Divide year by 100//3. If it doesn't have remainder -> quotient is century// 3.1. If it has remainder -> quotient + 1 is century//4. Output century // 처리과정//1. 연도를 입력받는다.//2. 연도를 100으로 나눠본다.//3. 나누어 떨어지면 몫(100단위)이 세기// 3.1. 나머지가 있으면 몫 + 1 이 세기//4. 세기를 출력한다. int centuryFromYear(int year) { int quotient = year / 100; int re..
Aracade Intro #1 Add 코드파이트 때 부터 아케이드 인트로 부분 C++로 푼 내용What I solved in CodeFights(CodeSignal) using C++ #1 int add(int param1, int param2) { return param1 + param2;}