개발 11

Codeforces Round #684 (Div. 2) Greedy Shopping

codeforces.com/contest/1439/problem/C Problem - C - Codeforces codeforces.com 구간 합을 구하고 변경해야 하므로 segment tree로 푸는 문제로 보인다. ecnerwala solution (codeforces.com/contest/1439/submission/98717653) 을 참고했다. segment tree가 뭐지? 배열 구간 (a,b)의 합을 lonN 시간에 구하고 logN의 시간에 수정 할 때 이용되는 이진 트리 구조이다. 시간 복잡도 : O(N) 공간 복잡도 : O(N*2) 최상 위 노드는 (1,N) 합 값을 갖는다. 부모 노드의 구간이 (a, b) 일 때, mid = (a+b)/2라 하면 왼쪽 자식과 오른쪽 자식은 각각 (a,..

개발/ps 2020.11.22

Kotlin Heroes 5: ICP Nov/12/202023:35UTC+9 정리

Jetbrain에서 kotlin 언어 활성화를 위해 주관하는 5번째 kotlin 대회에 참여했다. 코틀린 언어도 써보고 intelij IDE로 contest link를 입력하면 문제를 가져오고, submit 과 localtest 할 수 있는 게 편해서 참여했다. 2019년 5월에 첫 kotlin herores 이후 2달 ~ 6달에 한 두 번씩 개최하는 듯하다. 1, 2, 3위는 차례로 512$, 256$ 128$ 를 수여한다. 유머러스운 상금 숫자이다. 리워드가 있는지는 모르고 대회에 참여했다. score 3 accepted (A, B, C) / 10 problems D번 문제 wrong answer 대회 링크 : https://codeforces.com/contest/1431 Dashboard - Ko..

개발/ps 2020.11.15

Security 코드 Unit Test 시간 지연 원인 및 해결

SecureRandom 을 사용하여 난수를 생성하는 경우 처리시간이 하드웨어의 엔트로피에 의존하기 때문에 시간 지연이 발생할 수 있다. 참고 : tersesystems.com/blog/2015/12/17/the-right-way-to-use-securerandom/ The Right Way to Use SecureRandom · Terse Systems How do you generate a secure random number in JDK 1.8? It depends. The default: SecureRandom random = new SecureRandom(); byte[] values = new byte[20]; random.nextBytes(values); If you're okay with b..

개발/Android 2020.10.07

[Ubuntu] crontab 예약 작업 실행 프로그램

Crontab linux.die.net/man/5/crontab crontab(5): tables for driving cron - Linux man page crontab(5) - Linux man page Name crontab - tables for driving cron (ISC Cron V4.1) Description A crontab file contains instructions to the cron(8) daemon of the general form: "run this command at this time on this date". Each user has their own crontab, an linux.die.net crontab 으로 주기적으로 예약된 작업을 실행하도록 설정할 수 있..

개발/생산성 2020.10.06

Java "Switch vs If which is better for String comparison"

아래 링크 참고 https://stackoverflow.com/questions/41635131/gradle-getting-the-root-project-directory-path-when-starting-with-a-custom-buil#comment72687129_41635558 Gradle: getting the root project directory path when starting with a custom build file The structure of my Gradle project is the following: Project ├── app └── build.gradle ├── foo └── bar.txt · · · └── build.gradle Normally to get the abs..

개발/Code review 2020.07.31

Code Review: Return Empty Collections Instead of Null

함수에서 null을 반환하지 않도록 구현할 때의 장점이 있다. 함수 반환값을 받은 뒤 null check를 안해도 된다. Java에서 반환값이 Collection 이면 empty collection을 반환하는 것이 Null을 반환하는 것보다 낫다. https://dzone.com/articles/10-tips-to-handle-null-effectively 10 Tips to Handle Null Effectively - DZone Java Nulls and the dreaded NPE can be awful, but by maintaining encapsulation, keeping your code simple, and using nulls only in certain situations, you c..

개발/Code review 2020.07.27

Android Kakao talk SDK & Sample 실행

SDK 살펴보기 Android(ver.2) SDK & Samples 다운로드 https://developers.kakao.com/docs/latest/ko/sdk-download/android Kakao Developers 카카오 API를 활용하여 다양한 어플리케이션을 개발해보세요. 카카오 로그인, 메시지 보내기, 친구 API, 인공지능 API 등을 제공합니다. developers.kakao.com kakao-android-sdk-rx-2.0.0-beta06.zip 를 unzip 한다. SDK & Sample 구조 kakao-android-sdk-rx-2.0.0-beta06 폴더 구조 앱을 빌드하고 실행하면 아래와 같은 화면을 볼 수 있다. loginWithKakaoTalk() 사용 loginWithKa..

개발/Android 2020.07.25

[우분투(Ubuntu)] 20.04 ibus 한영 변환키 설정

Alt_R 을 한영 키로 인식하도록 수정해주는 방법이다. https://htamop.wordpress.com/2018/06/24/ubuntu-18-04-%ed%95%9c%ea%b8%80-%ec%84%a4%ec%a0%95/ Ubuntu 우분투 18.04 한글 설정 1.설치 및 한글 입력 추가 설치 sudo apt-get install ibus-hanul Settings – 지역 및 언어 – 입력 소스 + 버튼으로 Korean – hangul 추가 (Lanuage Setting Menu에서 직접 하면 안됨. 입력 소스에는 ‘한국어(Hangul) htamop.wordpress.com sudo vi /usr/share/X11/xkb/symbols/altwin, 아래 내용으로 교체 // Meta is mapped..

개발/생산성 2020.07.25