본문 바로가기

Occhiolism96

[프로그래머스 • 코틀린] 로또의 최고 순위와 최저 순위 #77484 #77484 🎄 Question ? Description Lotto 6/45(Hereinafter 'Lotto') is a popular lottery game where six numbers are drawn from a pool of 45 numbers. The lottery prize tiers are as follows1: Prize TiersRequirement 1 All six numbers match 2 Five numbers match 3 Four numbers match 4 Three numbers match 5 Two numbers match 6 (no prize) All other cases You bought a lotto ticket and have been waiting for .. 2024. 1. 17.
[TIL] ViewPager2 TapLayout 📖 Today I Learned 🔮 ViewPager2 & TapLayout 탭 레이아웃과 뷰페이저 2를 동시에 적용시키면 아래 탭 두개를 누름에 따라 그 안의 뷰가 바뀌고 양 옆으로 밀어도 이동한다. 탭 레이아웃을 적용시킬 액티비티에 들어가는 코드: - 뷰페이저 어댑터와 프래그먼트를 연결시켜 준다. - registerOnPageChangeCallBack 화면에 호출 시켜주는 코드?? - 탭 레이아웃과 뷰페이저도 연결 탭에 들어가는 문자열도 추가 package com.example.contactapp.activity import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.util.Log import an.. 2024. 1. 15.
[프로그래머스 • 코틀린] 기사단원의 무기 #136798 #136798 🎄 Question ? https://school.programmers.co.kr/learn/courses/30/lessons/136798# 🧩 Thought Process 소수의 개수를 셈할 수 있는 함수를 따로 만들고 소수의 개수가 제한 수 보다 크면 공격 수를 무게로 더해준다. 소수의 개수를 찾을 때 시간 복잡도를 고려해 주어야 한다. class Solution { fun solution(number: Int, limit: Int, power: Int): Int { var answer: Int = 0 for (i in 1..number) { var nLCD = countLCD(i) when { (nLCD > limit) -> answer += power else -> answer +=.. 2024. 1. 15.
[TIL] MVVM 적용 - 안드로이드 코틀린 (예시코드) 주석에 달아놓은 숫자 순서 따라가면서 읽어보면 이해가 더 쉽다. SignUpActivity.kt package com.example.startactitivity.signup import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts import androidx.lifecycle.ViewModelProvider import com.example.startactitivity.. 2024. 1. 12.