본문 바로가기

분류 전체보기824

0209. Sort the Gift Code Happy Holidays fellow Code Warriors! Santa's senior gift organizer Elf developed a way to represent up to 26 gifts by assigning a unique alphabetical character to each gift. After each gift was assigned a character, the gift organizer Elf then joined the characters to form the gift ordering code. Santa asked his organizer to order the characters in alphabetical order, but the Elf fell asleep fro.. 2023. 2. 9.
0209. Sort Out The Men From Boys Scenario Now that the competition gets tough it will Sort out the men from the boys . Men are the Even numbers and Boys are the odd!alt!alt Task Given an array/list [] of n integers , Separate The even numbers from the odds , or Separate the men from the boys!alt!alt Notes Return an array/list where Even numbers come first then odds Since , Men are stronger than Boys , Then Even numbers in ascen.. 2023. 2. 9.
0207. Divide and Conquer Given a mixed array of number and string representations of integers, add up the non-string integers and subtract this from the total of the string integers. Return as a number. Solution: def div_con(arr): x = sum(i for i in arr if isinstance(i, int)) y = sum(int(i) for i in arr if isinstance(i, str)) return x - y 2023. 2. 8.
0206. Find the nth Digit of a Number Complete the function that takes two numbers as input, num and nth and return the nth digit of num (counting from right to left). Note If num is negative, ignore its sign and treat it as a positive value If nth is not positive, return -1 Keep in mind that 42 = 00042. This means that findDigit(42, 5) would return 0 Examples(num, nth --> output) 5673, 4 --> 5 129, 2 --> 2 -2825, 3 --> 8 -456, 4 --.. 2023. 2. 7.
2023년 5주차 '문제를 해결할 수 있다는 믿음' 이토록 뜻밖의 뇌과학 뇌과학에 대해 쉽게 그리고 핵심을 잘 설명해 준 책이다. 특히 우리의 뇌는 완성되어 태어나는 것이 아니라 양육을 통해 만들어진다는 점이 가장 인상적이었다. 그래서 양육이 중요한 것이구나! 성인이 되어도 뇌는 일생동안 변할 수 있는데 이를 '뇌가소성'이라고 한다. 단어는 익히 들었지만 그 원리에 대해서는 잘 몰랐는데 이 책을 통해 자세히 알게 되었다. 뇌는 외부세계와의 상호작용을 통해 '세부조정'과 '가지치기'가 일어나는데 이때 뇌가 변하게 된다! 이에 대해 더 자세한 내용은 책에서 볼 수 있다. 나는 이 '세부조정'과 '가지치기'를 적극 활용하면 성인도 스스로를 양육할 수 있겠다는 생각이 들었다. 예를 들어 무언가를 해야 할 때 두렵거나 불안한 마음이 든다면 그것은 뇌가 과거의 경험.. 2023. 2. 6.
0205. pick a set of first elements Write a function to get the first element(s) of a sequence. Passing a parameter n (default=1) will return the first n element(s) of the sequence. If n == 0 return an empty sequence [] Examples arr = ['a', 'b', 'c', 'd', 'e'] first(arr) # --> ['a'] first(arr, 2) # --> ['a', 'b'] first(arr, 3) # --> ['a', 'b', 'c'] first(arr, 0) # --> [] Solution: def first(seq: list[str], n:int = 1) -> list[str]:.. 2023. 2. 5.