일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 2022 플러터 안드로이드 스튜디오
- 안드로이드 유닛 테스트 예시
- 플러터 설치 2022
- 멤버변수
- 안드로이드 라이선스
- 객체
- 안드로이드 레트로핏 사용법
- 서비스 vs 쓰레드
- jvm 작동 원리
- ar vr 차이
- 클래스
- jvm이란
- 안드로이드 라이선스 종류
- ANR이란
- 스택 큐 차이
- 스택 자바 코드
- 서비스 쓰레드 차이
- 자바 다형성
- 안드로이드 유닛 테스트
- 안드로이드 os 구조
- 안드로이드 레트로핏 crud
- rxjava hot observable
- android ar 개발
- android retrofit login
- rxjava disposable
- 큐 자바 코드
- 2022 플러터 설치
- Rxjava Observable
- 안드로이드 유닛테스트란
- rxjava cold observable
- Today
- Total
목록분류 전체보기 (1025)
나만을 위한 블로그

ex를 포함한 문자열을 빼고 나머지 문자열들을 이어붙이면 끝이다.StringBuilder를 써서 풀면 아래와 같다. class Solution { fun solution(strList: Array, ex: String): String { val sb = StringBuilder() return sb.append(strList.filter { !it.contains(ex) } .joinToString("") ).toString() }} StringBuilder를 쓰지 않는다면 아래와 같이 된다. class Solution { fun solution(strList: Array, ex: String) = strList.filter { !..

"abc"는 "aabcc"의 부분 문자열이다. 문자열 str1, str2가 주어질 때 str1이 str2의 부분 문자열이면 1, 아니면 0을 리턴하는 함수를 완성하라 contains()를 써서 포함되는지 여부에 따라 다른 숫자를 리턴시키면 끝이다. class Solution { fun solution(str1: String, str2: String): Int = if (str2.contains(str1)) 1 else 0}

MVVM 패턴 이후 MVI라는 새 패턴이 등장했다. MVI 패턴을 다룬 글은 2019년에도 있어서 등장한지 꽤 오래됐다고 생각된다.각설하고 MVI 패턴은 무엇인지 먼저 확인한다. https://medium.com/@mohammedkhudair57/mvi-architecture-pattern-in-android-0046bf9b8a2e MVI Architecture Pattern in AndroidA guide to adopt MVI pattern in your projectmedium.comMVI(모델-뷰-인텐트) 아키텍처는 앱을 3가지 주요 컴포넌트로 나눠서 깔끔한 코드, 명확한 관심사 분리를 강조한다. 이런 단방향 데이터 흐름과 뚜렷한 역할은 앱을 더 쉽게 이해하고 빌드, 유지보수하는 데 기여한다. 또..

target을 포함하면 1, 아니면 0을 리턴하면 된다. class Solution { fun solution(my_string: String, target: String): Int = if (my_string.contains(target)) 1 else 0}

정수 배열 arr, delete_list가 있을 때 arr의 원소 중 delete_list의 원소를 모두 삭제하고 남은 원소들은 기존의 arr에 있던 순서를 유지한 배열을 리턴하는 함수를 완성하라 간단하게 풀면 아래와 같이 풀 수 있다. class Solution { fun solution(arr: IntArray, deleteList: IntArray) = arr.toList() - deleteList.toSet()} 컬렉션 함수를 쓰는 방법도 있다. class Solution { fun solution(arr: IntArray, delete_list: IntArray): IntArray = arr.map { arr.filter { !delete_list.contains(it)..

정수 n이 주어질 때, n을 문자열로 바꿔 리턴하는 함수를 완성하라 그냥 toString() 한 번 쓰면 된다. class Solution { fun solution(n: Int): String = n.toString()}

0 이상의 두 정수가 문자열 a, b로 주어질 때 a + b의 값을 문자열로 리턴하는 함수를 완성하라 문자열 a, b의 길이가 모두 길기 때문에 BigInteger를 사용해서 풀 수 있다. import java.math.*class Solution { fun solution(a: String, b: String): String = BigDecimal(a).plus(BigDecimal(b)).toString()} 또는 StringBuilder, BigInteger를 같이 사용하는 방법도 있다. class Solution { fun solution(a: String, b: String): String = StringBuilder().apply { append(a.toBigIntege..

정수로 이뤄진 문자열 n_str이 주어질 때, n_str의 가장 왼쪽에 처음 등장하는 0들을 뗀 문자열들을 리턴하는 함수를 완성하라 코틀린의 trimStart()를 쓰면 바로 풀 수 있다. class Solution { fun solution(n_str: String): String = n_str.trimStart('0')} 이 함수는 문자열에서 매개변수로 주어진 문자들이 제거된 문자열을 리턴한다.그래서 매개변수로 '0'을 넣으면 앞에 0이 몇 개가 있든 0을 지운 문자열을 리턴한다.만약 뒤에 있는 0을 제거해야 한다면 trimEnd()를 쓰면 된다.

숫자로만 이뤄진 문자열 n_str이 주어질 때, n_str을 정수로 바꿔서 리턴하는 함수를 완성하라 그냥 toInt() 한 번 쓰면 끝난다. class Solution { fun solution(n_str: String): Int = n_str.toInt()}

한 자리 정수로 이뤄진 문자열 num_str이 주어질 때, 각 자리수의 합을 리턴하는 함수를 완성하라 코틀린에서 String은 결국 여러 char들이 모인 CharSequence다.그렇다면 map을 써서 각 char들을 순회하며 숫자로 바꾼 다음 sum()으로 바뀐 숫자들의 총합을 구해서 리턴하면 끝난다. class Solution { fun solution(num_str: String): Int = num_str.map { it.toString().toInt() }.sum()}