'2017/06'에 해당되는 글 47건

  1. 2017.06.07 5. shapeArea 1
  2. 2017.06.07 4. adjacentElementsProduct 1
  3. 2017.06.07 3. checkPalindrome 1
  4. 2017.06.07 2. centuryFromYear 1
  5. 2017.06.07 1. add 1
  6. 2017.06.07 https://codefights.com
  7. 2017.06.06 2017 빛가람 에너지밸리 ICT 컨퍼런스
알고리즘(CF)2017. 6. 7. 21:42

Below we will define an n-interesting polygon. Your task is to find the area of a polygon for a given n.

1-interesting polygon is just a square with a side of length 1. An n-interesting polygon is obtained by taking the n - 1-interesting polygon and appending 1-interesting polygons to its rim, side by side. You can see the 1-, 2-, 3- and 4-interesting polygons in the picture below.



Example


  • For n = 2, the output should be
    shapeArea(n) = 5;
  • For n = 3, the output should be
    shapeArea(n) = 13.



Code


int shapeArea(int n) {
2

 

3
}


'알고리즘(CF)' 카테고리의 다른 글

7. almostIncreasingSequence  (1) 2017.06.07
6. make Array Consecutive2  (1) 2017.06.07
4. adjacentElementsProduct  (1) 2017.06.07
3. checkPalindrome  (1) 2017.06.07
2. centuryFromYear  (1) 2017.06.07
Posted by EL2A
알고리즘(CF)2017. 6. 7. 21:36

Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.

일련의 정수를 확인하여, 가장 큰 수와 인접한 요소를 찾아 곱한 값을 구하라



Example


For inputArray = [3, 6, -2, -5, 7, 3], the output should be
adjacentElementsProduct(inputArray) = 21.

7 and 3 produce the largest product.


inputArray: [-1, -2]

Expected Output:2


inputArray: [5, 1, 2, 3, 1, 4]

Expected Output: 6


inputArray: [9, 5, 10, 2, 24, -1, -48]

Expected Output: 50




Code


int adjacentElementsProduct(int[] inputArray) {
2

 

9
}


'알고리즘(CF)' 카테고리의 다른 글

6. make Array Consecutive2  (1) 2017.06.07
5. shapeArea  (1) 2017.06.07
3. checkPalindrome  (1) 2017.06.07
2. centuryFromYear  (1) 2017.06.07
1. add  (1) 2017.06.07
Posted by EL2A
알고리즘(CF)2017. 6. 7. 21:28

Given the string, check if it is a palindrome.

해당 문자열을 고려하여 회문인지 확인하라



Example


  • For inputString = "aabaa", the output should be
    checkPalindrome(inputString) = true;
  • For inputString = "abac", the output should be
    checkPalindrome(inputString) = false;
  • For inputString = "a", the output should be
    checkPalindrome(inputString) = true.


Code


boolean checkPalindrome(String inputString) {
2

 

12
}


'알고리즘(CF)' 카테고리의 다른 글

5. shapeArea  (1) 2017.06.07
4. adjacentElementsProduct  (1) 2017.06.07
2. centuryFromYear  (1) 2017.06.07
1. add  (1) 2017.06.07
https://codefights.com  (0) 2017.06.07
Posted by EL2A
알고리즘(CF)2017. 6. 7. 21:21

Given a year, return the century it is in. The first century spans from the year 1 up to and including the year 100, the second - from the year 101 up to and including the year 200, etc.

년도를 넣으면 해당세기를 구하라



Example


  • For year = 1905, the output should be
    centuryFromYear(year) = 20;
  • For year = 1700, the output should be
    centuryFromYear(year) = 17.



Code


int centuryFromYear(int year) {
2

 

3
}


'알고리즘(CF)' 카테고리의 다른 글

5. shapeArea  (1) 2017.06.07
4. adjacentElementsProduct  (1) 2017.06.07
3. checkPalindrome  (1) 2017.06.07
1. add  (1) 2017.06.07
https://codefights.com  (0) 2017.06.07
Posted by EL2A
알고리즘(CF)2017. 6. 7. 21:08

Write a function that returns the sum of two numbers.

두 숫자의 합을 반환하는 함수를 작성합니다.



Example


For param1 = 1 and param2 = 2, the output should be
add(param1, param2) = 3.




Code


1
int add(int param1, int param2) {
2

 

3
}


'알고리즘(CF)' 카테고리의 다른 글

5. shapeArea  (1) 2017.06.07
4. adjacentElementsProduct  (1) 2017.06.07
3. checkPalindrome  (1) 2017.06.07
2. centuryFromYear  (1) 2017.06.07
https://codefights.com  (0) 2017.06.07
Posted by EL2A
알고리즘(CF)2017. 6. 7. 21:06



현재 카테고리에서 제공되는 문제 소스의 출처는 아래의 사이트에 있으며 정답은 코멘트에 있습니다.


https://codefights.com

'알고리즘(CF)' 카테고리의 다른 글

5. shapeArea  (1) 2017.06.07
4. adjacentElementsProduct  (1) 2017.06.07
3. checkPalindrome  (1) 2017.06.07
2. centuryFromYear  (1) 2017.06.07
1. add  (1) 2017.06.07
Posted by EL2A
끄적끄적2017. 6. 6. 13:23








전남나주시 한전KDN에서 진행했던 컨퍼런스


'끄적끄적' 카테고리의 다른 글

유지보수가 어렵게 코딩하는 방법  (0) 2017.03.24
깃 명령어 간단 정리  (2) 2017.03.24
크롬 플러그인 데모 번역  (0) 2017.03.24
크롬 플러그인 만들기  (0) 2017.03.24
개인적인 프로그램  (0) 2017.03.24
Posted by EL2A