분류 전체보기

    [Kotlin] Collection 정리 list, set, map 차이 - HashMap, hashmapof, mutableMap, setOf, mutableSetOf,ArrayListof,listof 사용법 및 차이

    [Kotlin] Collection 정리 list, set, map 차이 - HashMap, hashmapof, mutableMap, setOf, mutableSetOf,ArrayListof,listof 사용법 및 차이

    [Kotlin] Collection 정리 list, set, map 차이 - HashMap, HashMapOf, MutableMap, SetOf, MutableSetOf, ArrayListof, ListOf HashMap, hashmapof, mutableMap, setOf, mutableSetOf, ArrayListof, listof 들의 공통점은 모두 Collection이라는 점입니다. collection은 데이터를 모아 관리와 사용을 편리하게 하기 위해 만들어진 프레임워크입니다. Collection들을 이해하기 전 Collection을 구분 짓는 법부터 알아야 합니다. 코틀린은 크게 변경 가능한(Mutable), 변경 불가능한(Immutable) Collection으로 나눕니다. 그리고 그아래 Li..

    [Kotlin] Array에 반복되는 아이템 삭제하기 - ArrayList distinct - LeetCode: Contains Duplicate - 풀이 과정

    [Kotlin] Array에 반복되는 아이템 삭제하기 - ArrayList distinct - LeetCode: Contains Duplicate - 풀이 과정

    [Kotlin] Array에 반복되는 아이템 삭제하기 - ArrayList distinct - LeetCode: Contains Duplicate - 풀이 과정 문제 Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Array에서 2번이상 반복되는 value가 있을경우 true를 return하고 반복되는 값이없으면 false를 return 하도록 하는게 이 문제의 목표입니다. Arraylist에 Distinct를 사용해서 반복되는 값을 지우고 기존 Array와 지운값의 Array를 비교하여 boolean을 반환..

    [Kotlin] LeetCode - Best Time to Buy and Sell Stock IISolution - 풀이과정

    [Kotlin] LeetCode - Best Time to Buy and Sell Stock IISolution - 풀이과정

    문제 You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times). Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again). 그날의 stock 가격이 prices라는 array에..

    [Kotlin] String, Int 순서 뒤집기 - LeetCode: Reverse Integer 풀이

    [Kotlin] String, Int 순서 뒤집기 - LeetCode: Reverse Integer 풀이

    문제 Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assume the environment does not allow you to store 64-bit integers (signed or unsigned). 예시 x를 넣으면 reversed된 값을 반환하게 만들어야합니다. 풀이 1. String으로 변환후 순서 뒤집기 저는 integer을 string으로 바꿔서 char 하나씩 접근하여 보내려했는데 //오답 fun reverse(x:..