본문 바로가기

코딩/코딜리티 문제 풀기4

코딜리티 2-2 OddOccurrencesInArray (python) 미솔이랑 강동구에서 불법 주차 조사 알바를 했는데, 중간에 쉬는시간이랑 식사시간이 남을 때마다 피씨방에 가서 놀았다 ㅎㅎ. 피씨방에서 할 게 없어서 연말 배당주도 검색해보고 코딜리티도 풀었다~~!~! 1째 시도: correctness = 100%, performance = 25%. 퍼포먼스가 안나온다ㅠㅠ def solution(A): while A!=[]: a = A[0] del A[0] if a in A: A.remove(a) else: return a 2째시도: correctness = 100%, performance = 100% def solution(A): N = len(A) if N 2020. 11. 9.
코딜리티 2-1 CyclicRotation (python) 1째 시도: correctness와 performace 둘 다 100%긴 한데 코드가 지저분하다. def solution(A, K): # given an array A consisting of N integers and an integer K, returns the array A rotated K times. N = len(A) if N=N: K = K%N B=[] for i in range(0, K): B.append(A[N-K+i]) for j in range(0, N-K): B.append(A[j]) return B 2째 시도: python의 list slicing 방법을 알게되어 적용했다. 좀 더 깔끔하게 코딩했다. def solution(A, K): # given an array A consis.. 2020. 11. 8.
코딜리티 1 Binary Gap (python) + 티스토리 코드블럭 예쁘게하기 오랜만에 파이썬 코딩을 해봤다. ROS를 쓰면서도 iiwa_stack이 C++을 써서 파이썬 코딩을 할 새가 없었는데, 요즘 fetch 쓰는 바람에 파이썬을 보고 있다. 파이썬도 다시 좀 익힐 겸 파이썬으로 코딜리티를 풀어보려고 한다! 첫 번째 문제는 뭐,, 너무 쉬웠다. 리스트 쓰는 방법을 remind 하는 정도였다. Correctness = 100%, Performance = 100% 가 나왔다. def solution(N): # given intever N, return the length of its longest binary gap binary = bin(N)[2:] index_one = [] bin_gap = [] for i in range(len(binary)): if binary[i]=='.. 2020. 11. 6.
Codility (코딜리티) 로 코딩 연습하기! 코딜리티는 백준, 프로그래머스처럼 코딩 연습을 할 수 있는 사이트이다. 네이버 등에서 채용을 위한 코딩 테스트를 할 때도 사용한다고 해서 문제 풀기 연습을 여기서 하려고 한다. www.codility.com/ Tech Recruiting Platform, Remote Online Code Testing | Codility Codility is a software platform that helps technical recruiters run remote interviews and hire strong engineers. Explore our platform by requesting a demo today www.codility.com 작성한 코드의 Correctness 뿐만 아니라 performance도.. 2020. 11. 6.
반응형