본문 바로가기

append11

Delete occurrences of an element if it occurs more than n times Description: Enough is enough! Alice and Bob were on a holiday. Both of them took many pictures of the places they've been, and now they want to show Charlie their entire collection. However, Charlie doesn't like these sessions, since the motive usually repeats. He isn't fond of seeing the Eiffel tower 40 times. He tells them that he will only sit during the session if they show the same motive .. 2022. 4. 2.
Multiplication table Description: Your task, is to create NxN multiplication table, of size provided in parameter. for example, when given size is 3: 1 2 3 2 4 6 3 6 9 for given example, the return value should be: [[1,2,3],[2,4,6],[3,6,9]] Solution: 1. Use the for statement twice to create a two-dimensional array. 2. The numbers in the given array are added in the second for statement. 3. Returns the numbers in a t.. 2022. 3. 19.
Primorial Of a Number Description: Definition (Primorial Of a Number) Is similar to factorial of a number, In primorial, not all the natural numbers get multiplied, only prime numbers are multiplied to calculate the primorial of a number. It's denoted with P# and it is the product of the first n prime numbers. Task Given a number N , calculate its primorial. Notes Only positive numbers will be passed (N > 0) . Input .. 2022. 3. 18.
Tribonacci Sequence 문제 설명 Well met with Fibonacci bigger brother, AKA Tribonacci. As the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of the sequence to generate the next. And, worse part of it, regrettably I won't get to hear non-native Italian speakers trying to pronounce it :( So, if we are to start our Tribonacci sequence with [1, 1, 1] as a startin.. 2022. 2. 10.
선형배열 배열이란? 배열이란 연관된 데이터를 하나의 변수에 그룹핑해서 관리하기 위한 방법 리스트 길이과 관계 없이 빠르게 실행 결과를 보게되는 연산들 요소 마지막에 추가 .append('삽입할 요소') 요소 마지막 혹은 지정된 인덱스에서 꺼내기 .pop('꺼낼 인덱스') 리스트의 길이에 비례해서 실행 시간이 걸리는 연산들 요소 삽입하기 '리스트명'.insert('인덱스', '삽입할 요소') 요소 삭제하기 del('리스트명['인덱스']') 리스트의 길이에 실행 시간이 비례. 오래걸리는 이유는? 리스트의 중간이 수정되어 전체 인덱스가 변경되기 때문. 추가 다른 연산 요소 탐색하기: '리스트명'.index('찾을 요소') 실습1. 리스트 L 에 정수 x를 숫자 크기에 알맞게 넣는 코드 def solution(L, x).. 2022. 1. 25.