반응형

시간 복잡도: O(N + M) --> 100%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(S, P, Q):
    # write your code in Python 3.6
    
    # step 1 - input array S,P,Q
    # already succeed
    
    # step 2 - get range from array P,Q
    M = len(P)
    
    return_arr = []
    
    # step 3 - do the job(for senetence)
    for i in range(M):
        arr = S[P[i]:Q[i]+1]
        try:
            arr.index('A')
            return_arr.append(1)
        except:
            try:
                arr.index('C')
                return_arr.append(2)
            except:
                try:
                    arr.index('G')
                    return_arr.append(3)
                except:
                    return_arr.append(4)
                    
    return return_arr
        
    pass
반응형

'Codility' 카테고리의 다른 글

Codility - PassingCars  (0) 2020.04.20
Codility - MinAvgTwoSlice  (0) 2020.04.19
Codility - CountDiv  (0) 2020.04.18
Codility - PermCheck  (0) 2020.04.18
Codility - MissingInteger  (0) 2020.04.17
반응형

시간 복잡도: O(B-A) --> 50%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A, B, K):
    # write your code in Python 3.6
    
    # step 1 - input A,B,K
    # already succeed
    
    # step 2 - do the for sentence
    return_value = 0
    
    for i in range(A,B+1):
        if i % K == 0:
            return_value += 1
            
    return return_value
    pass

시간 복잡도: O(1) --> 100%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A, B, K):
    # write your code in Python 3.6
    
    start_num = A/K
    end_num = int(B/K)
    
    if start_num%1 != 0:
        start_num = int(start_num) + 1
    else:
        start_num = int(start_num)
    
        
    return end_num - (start_num-1)
    pass

 

반응형

'Codility' 카테고리의 다른 글

Codility - MinAvgTwoSlice  (0) 2020.04.19
Codility - GenomicRangeQuery  (0) 2020.04.19
Codility - PermCheck  (0) 2020.04.18
Codility - MissingInteger  (0) 2020.04.17
Codility - MaxCounters  (0) 2020.04.15
반응형

시간 복잡도: O(N) or O(N * log(N)) --> 100%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A):
    # write your code in Python 3.6
    
    # step 1 - get input A
    # already succeed
    
    # step 2 - sorting A, which is consist of positive integer
    A = sorted(A)
    
    # step 3 - do the job(for sentence)
    a = 1
    
    for i in A:
        if i == a:
            a += 1
        else:
            return 0
            
    return 1
    
    
    pass
반응형

'Codility' 카테고리의 다른 글

Codility - GenomicRangeQuery  (0) 2020.04.19
Codility - CountDiv  (0) 2020.04.18
Codility - MissingInteger  (0) 2020.04.17
Codility - MaxCounters  (0) 2020.04.15
Codility - FrogRiverOne  (0) 2020.04.13
반응형

시간 복잡도: O(N) or O(N * log(N)) --> 77%의 정답률 (Wrong answer 가 있었음)

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A):
    # write your code in Python 3.6
    
    # step 1 - input array A
    # already succeed
    
    # step 2 - find the smallest positive integer of A
    
    # sorting A
    A = sorted(A)
    
    # find the positive integer
    try:
        a = A.index(1)
        tmp = A[a:]
        tmp = set(tmp)
    except:
        return 1
        
    b = 1
    
    for i in tmp:
        if i == b:
            b += 1
        else:
            return b
            
    return b
        
    
    pass

시간 복잡도: O(N) or O(N * log(N)) --> 100%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A):
    # write your code in Python 3.6
    
    # step 1 - input array A
    # already succeed
    
    # step 2 - find the smallest positive integer of A
    
    # sorting A
    A = set(A)
    A = sorted(A)
    
    # find the positive integer
    try:
        a = A.index(1)
        tmp = A[a:]
    except:
        return 1
        
    b = 1
    
    for i in tmp:
        if i == b:
            b += 1
        else:
            return b
            
    return b
        
    
    pass
반응형

'Codility' 카테고리의 다른 글

Codility - CountDiv  (0) 2020.04.18
Codility - PermCheck  (0) 2020.04.18
Codility - MaxCounters  (0) 2020.04.15
Codility - FrogRiverOne  (0) 2020.04.13
Codility - TapeEquilibrium  (0) 2020.04.13
반응형

시간 복잡도: O(N*M) --> 66%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(N, A):
    # write your code in Python 3.6
    
    # step 1 - make a arr, consist of int '0', length is N
    tmp = [0]*N
    
    # do the job along case
    for i in A:
        if i <= N and i >= 1:
            tmp[i-1] += 1
            continue
        if i == N + 1:
            tmp = [max(tmp)]*N
    
    
    return tmp
        
            
    pass

시간 복잡도: O(N*M) --> 66%의 정답률

 

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(N, A):
    # write your code in Python 3.6
    
    # step 1 - input N,A
    # already succeed
    
    # step 2 - get for setence
    tmp = [0]*N
    
    for i in A:
        try:
            tmp[i-1] += 1
        except:
            tmp = [max(tmp)]*N
    return tmp
    
    
    pass

 

다른 사람의 코드 : 시간 복잡도: O(N+M) --> 100%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(N, A):
    # write your code in Python 3.6
    
    # step 1 - input N,A
    # already succeed
    
    # step 2 - get for setence
    counters = N * [0]
    next_max_counter =  max_counter = 0
    
    for oper in A:
        try:
            current_counter = counters[oper-1] = max(counters[oper-1] +1, max_counter+1)
            next_max_counter = max(current_counter, next_max_counter)
        except:
            max_counter = next_max_counter
    
    
    return [c if c > max_counter else max_counter for c in counters]
    
    
    pass
반응형

'Codility' 카테고리의 다른 글

Codility - PermCheck  (0) 2020.04.18
Codility - MissingInteger  (0) 2020.04.17
Codility - FrogRiverOne  (0) 2020.04.13
Codility - TapeEquilibrium  (0) 2020.04.13
Codility - PermMissingElem  (0) 2020.04.12
반응형

Expo.io 란?

 

공식홈페이지에서는 아래와 같이 나와있네요

 

Expo is a framework and a platform for universal React applications. It is a set of tools and services built around React Native and native platforms that help you develop, build, deploy, and quickly iterate on iOS, Android, and web apps from the same JavaScript/TypeScript codebase.

 

Expo

Expo is an open-source platform for making universal native apps for Android, iOS, and the web with JavaScript and React.

expo.io

다음과 같이 설명이 되어있는데, 한글로 풀자면, 

 

JavaScript/TypeScript 코드베이스로 하나만 짜놓으면, iOS, Android, Wep App 모두 만들 수 있는 그런 환경을 제공해주는 플랫폼입니다.

 

웹페이지로 서비스를 하고 있어, 접근성이 좋습니다.

 

 

전체적인 사용법은 크게 2파트로 나뉩니다.

 

1. 웹페이지에서 코드를 짠다.(개발, 빌드, 배포까지 해줍니다.)

2. 모바일에서 빌드된 프로그램을 사용해본다.

 

 

 

 

1번째, 웹페이지에 들어가셨으면, 회원가입을 해주시고,

 

우측 상단에 Snack 버튼을 누르면 나오는 창

 

Snack 을 누른 후에 우층 하단에 "Create a new Snack" 버튼을 눌러서 코드를 개발해주시면 됩니다.

 

코드 개발하면서 중간중간에 확인해보고 싶으실 때는,

 

물론 옆에 있는 애뮬레이터에서 바로바로 확인을 할 수 있습니다.

우측 상단에 Run 버튼을 눌러주시고,

 

QR 코드를 눌러주시고,

모바일 expo 어플을 받으신 후에 해당 QR 코드를 찍어주시면 됩니다.

 

여기서 2번째 모바일로 프로그램을 사용하기 위해서는 

 

'Expo' 확인 - https://play.google.com/store/apps/details?id=host.exp.exponent

 

Expo - Google Play 앱

Start building rich experiences with just your Android device and your computer. Expo is a developer tool for creating experiences with interactive gestures and graphics, using JavaScript and React Native. To learn more visit https://expo.io. Some programm

play.google.com

모바일에서 PlayStore 들어가셔서 다운로드 받으셔야 합니다.

 

 

 

모바일에서 저장 받은 후에 웹페이지에서 QR 코드를 입력받아서 사용하시면 됩니다.

반응형

'IT' 카테고리의 다른 글

os, readonly 파일 수정방법(feat, sudoers 수정)  (0) 2020.04.20
이맥스 자동완성 기능 설치  (0) 2020.04.20
MacBook에 VM 설치  (0) 2020.04.14
이맥스 사용법  (0) 2020.04.09
angular 4200 포트 강제 종료  (0) 2020.04.09
반응형

아래 따라하시면 됩니다.

 

 

1. Virtualbox 링크에 들어간다.

https://www.virtualbox.org/

 

Oracle VM VirtualBox

Welcome to VirtualBox.org! News Flash New February 21st, 2020VirtualBox 5.2.38 released! Oracle today released a 5.2 maintenance release which improves stability and fixes regressions. See the Changelog for details. New February 21st, 2020VirtualBox 6.0.18

www.virtualbox.org

2. 파란색 Download VirtualBox 6.1 클릭한다.

3. VirtualBox 6.1.4 버전을 구동할 hosts 운영체제에 맞게 설치 파일을 클릭한다.

 

 

 

4. 설치가 진행중인 것을 확인한다.

 

5. 설치 완료 시 파일을 클릭하여 설치를 진행한다.

 

 

6. VirtualBox.pkg 파일을 더블클릭한다.

6-1 Application 폴더 아이콘을 더블 클릭하여 설치된 VM.pkg를 더블클릭한다.

 

7. "계속" 버튼 클릭

 

 

8. "계속" 버튼 클릭

 

9. "설치" 버튼 클릭

 

 

10. 자신의 mac 계정 비밀번호 입력하여 설치 진행

 

11. 설치 진행중..

 

 

12. 시스템 확장 프로그램 차단 알림 발생 >> "보안 환결설정 열기" 클릭

 

 

13. 창이 뜨면 하단의 자물쇠 표시 눌러서 잠금 해제 >> 계정 비밀번호 입력

13.-1 '일부 시스템 소프트웨어가 차단되어 로드할 수 없습니다' 옆에 "허용...." 클릭

 

 

14.  Oracle America, Inc, 체크하고 "확인" 클릭

 

 

15. 다시 응용프로그램 >> VirtualBox.pkg 더블클릭하여 아까와 동일하게 설치 진행

15-1 설치 완료!!

 

 

16. 응용프로그램에 설치된 VirtualBox 확인.

 

 

 

 

 

 

 

반응형

'IT' 카테고리의 다른 글

이맥스 자동완성 기능 설치  (0) 2020.04.20
Expo.io를 이용한 React native 앱 만들기  (0) 2020.04.14
이맥스 사용법  (0) 2020.04.09
angular 4200 포트 강제 종료  (0) 2020.04.09
pytorch로 MNIST 분류하기  (0) 2020.04.06
반응형

시간 복잡도: O(N**2) --> 54%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(X, A):
    # write your code in Python 3.6
    
    # step 1 - input x,a
    # already succeed
    
    # step 2 - if 1,2,3,.. in arr then, change the index into 0
    # else: continue
    
    arr = list(range(1,X+1))
    
    for i in range(len(A)):
        if A[i] in arr:
            arr[A[i]-1] = 0
            if sum(arr) == 0:
                return i
           
    pass

 

시간 복잡도: O(N) --> 100%의 정답률

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(X, A):
    # write your code in Python 3.6
    
    # step 1 - input x,a
    # already succeed
    
    # step 2 - # step 2 - if 1,2,3,.. in arr then, change the index into 0
    # else: continue
    
    check = [0] * X
    check_sum = 0
    
    for i in range(len(A)):
        if check[A[i]-1] == 0:
            check[A[i]-1] = 1
            check_sum += 1
            
            if check_sum == X:
                return i
                
    return -1
        
    pass

 

반응형

'Codility' 카테고리의 다른 글

Codility - MissingInteger  (0) 2020.04.17
Codility - MaxCounters  (0) 2020.04.15
Codility - TapeEquilibrium  (0) 2020.04.13
Codility - PermMissingElem  (0) 2020.04.12
Codility - FrogJmp  (0) 2020.04.11

+ Recent posts