본문 바로가기

전체 글234

[LeetCode][Kotlin] 2009. Minimum Number of Operations to Make Array Continuous 2009. Minimum Number of Operations to Make Array ContinuousYou are given an integer array nums. In one operation, you can replace any element in nums with any integer.nums is considered continuous if both of the following conditions are fulfilled:All elements in nums are unique.The difference between the maximum element and the minimum element in nums equals nums.length - 1.For example, nums = [.. 2024. 11. 26.
[CS] 블록체인(Blockchain) 우리는 Facebook, 우버와 같은 서비스나 은행 시스템과 같은 중앙집중원장(Centralized ledger)을 이용해 왔다. 이는 그들이 우리의 데이터를 잘 관리하고 처리해 줄 것이라는 신뢰가 있었기 때문이다우리는 이러한 기관, 기업에게 신뢰비용(수수료 등)을 지불하고 그들은 서비스를 제공하며 데이터를 보관(보안)하고 활용한다.이렇게 지금까지 자본주의가 발전하면서 신뢰받는 제 3자에게 어떤 권한을 위임해 왔고 그들에게 서비스를 받으며 성장해 왔다.기존 중앙집중형 시스템의 문제점1. 비용 문제제 3자인 중앙집중형 관리시스템은 거래자들 사이에서 과도한 관리, 중개수수료를 청구한다.중앙집중형 시스템은 데이터베이스를 유지, 관리하기 위해 많은 보안유지비용을 지출한다.금융권의 경우 매년 천문학적인 돈을 보안.. 2024. 11. 25.
[Compose] TextField에서 키보드 hide 처리하기 https://velog.io/@jmseb3/Compose-TextField-%EC%97%90%EC%84%9C-%ED%82%A4%EB%B3%B4%EB%93%9C-hide-%EC%B2%98%EB%A6%AC%ED%95%98%EA%B8%B0 [Compose] TextField 에서 키보드 hide 처리하기이러면 키보드가 내려가지만 textfield의 경우 커서가 남아있는 문제가있다.이러면 focus가 사라지면서 자동으로 키보드가 내려간다.velog.io// 키보드가 내려가지만, textfield의 경우 커서가 남아있는 문제가 있다.val keyboardController = LocalSoftwareKeyboardController.currentkeyboardController?.hide()// focus가 사.. 2024. 11. 23.
[Compose] Side Effect와 Effect API(LaunchedEffect, rememberCoroutineScope 등) Side Effect (부수 효과)Composable 함수를 벗어난 곳에서 앱의 state(상태) 변경이 일어나는 것Composable 은 Side Effect 가 없는 것이 좋으나, 앱 상태를 변경해야 하는 경우 Side Effect 를 예측 가능한 방식으로 실행되도록 Effect API 를 사용해야 한다.한 번만 일어나는 UI 이벤트로 변경 사항이 state 로 관리될 필요가 없는 경우 (SnackBar, ToastMessage 등)다른 Screen 으로 이동하는 Navigation (사용자 인터랙션(예시: 버튼 클릭)에 의해 발생하는 경우 필요 없음)system services 들과 상호작용 하는 것Coroutine 을 이용한 네트워킹이나 디스크 IO 1. LaunchedEffect@Composab.. 2024. 11. 23.
[LeetCode][Kotlin] 992. Subarrays with K Different Integers 992. Subarrays with K Different IntegersGiven an integer array nums and an integer k, return the number of good subarrays of nums.A good array is an array where the number of different integers in that array is exactly k.For example, [1,2,3,1,2] has 3 different integers: 1, 2, and 3.A subarray is a contiguous part of an array.정수 배열 nums와 정수 k가 주어지면 nums의 좋은 부분 배열의 개수를 반환합니다. 좋은 배열은 해당 배열의 다른 정수의.. 2024. 11. 22.
[Compose] TextField에서 엔터키 사용하기 https://velog.io/@dddiri/TextField%EC%97%90%EC%84%9C-%EC%97%94%ED%84%B0-%ED%82%A4-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0 Jetpack Compose TextField에서 엔터키 사용하기TextField의 keyboardActions, keyboardOptions 속성을 이용하여 엔터키를 자유롭게 커스텀할 수 있습니다. 물론 엔터키 외의 다른 키도 커스텀 할 수 있지만, 이번 글에서는 엔터키를 커스텀 하는 방법만 다velog.io@Composablefun InputText( ... submit: () -> Unit = {}) { val keyboardController = LocalSoftwareK.. 2024. 11. 21.
[LeetCode][Kotlin] 239. Sliding Window Maximum 239. Sliding Window MaximumYou are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return the max sliding window.정수 nums 배열이 주어지고, 배열의 가장 왼쪽에서 가장 오른쪽으로 이동하는 k 크기의 슬라이딩 윈도우가 있습니다. 윈도우에서 k개의 숫자만 볼 수 있습니다. 슬라이.. 2024. 11. 21.