문제 설명 단어 s의 가운데 글자를 반환하는 함수, solution을 만들어 보세요. 단어의 길이가 짝수라면 가운데 두글자를 반환하면 됩니다. 재한사항 s는 길이가 1 이상, 100이하인 스트링입니다. 입출력 예 s return abcde c qwer we Solution 1 in Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class Solution { public String solution(String s) { String answer = ""; int position = 0; int length = 0; if (s.length() % 2 == 0){ position = s.length() / 2 - 1; length = 2; }else if(s.length(..
Methods of String class substring()to get substring using substring(include index,exclude index); 12String i="java"; System.out.println(i.substring(1,2));//a cs length()to get the length of the string. 123String s="javastring"; System.out.println("string length is: "+s.length());//10 Colored by Color Scriptercs equals() equals() method compares two strings found on the content of the string. if ..
- Total
- Today
- Yesterday
- javascript
- compareTo()
- C++
- Object type casting
- string class in java
- spring boot application
- hackerrank javascript solution
- Javascript Algorithm
- HashMap
- repeat()
- java
- math.max
- hackerrank
- easy algorithm
- HackerRank Algorithm
- algorithm
- math.abs
- rest parameter
- 프로그래머스
- 알고리즘
- code refactoring
- ... in Javascript
- easy javascript algorithm
- hackerrank javascript
- 프로그래머스 알고리즘
- equals()
- 프로그래머스 알고리즘문제
- hackerrank solution
- substring()
- Collection Framework
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |