본문 바로가기

전체 글451

36.Does my number look big in this? Description: A Narcissistic Number is a positive number which is the sum of its own digits, each raised to the power of the number of digits in a given base. In this Kata, we will restrict ourselves to decimal (base 10). For example, take 153 (3 digits), which is narcisstic: 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153 and 1652 (4 digits), which isn't: 1^4 + 6^4 + 5^4 + 2^4 = 1 + 1296 + 625 + 16 = 1938 .. 2022. 4. 10.
35.Unique In Order Description: Implement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements. For example: uniqueInOrder('AAAABBBCCDAABBB') == ['A', 'B', 'C', 'D', 'A', 'B'] uniqueInOrder('ABBCcAD') == ['A', 'B', 'C', 'c', 'A', 'D'] uniqueInOrder([1,2,2,3,3]) == [1,2,3].. 2022. 4. 9.
34.Decode the Morse code Description: Part of Series 1/3 This kata is part of a series on the Morse code. After you solve this kata, you may move to the next one. In this kata you have to write a simple Morse code decoder. While the Morse code is now mostly superseded by voice and digital data communication channels, it still has its use in some applications around the world. The Morse code encodes every character as a .. 2022. 4. 8.
React Router 오류 / TypeScript VFC FC 차이 프로젝트를 하던 중에 react-router-dom 5.2.0 버전이랑 6.3.0 버전이랑 Router 사용하는 방법이 달라서 Error: useRoutes() may be used only in the context of a component. 이런 에러가 났다. 찾아보니 버전이 업그레이드 되면서 사용 방법이 달라졌더라,, Route를 Routes로만 감싸서 사용을 했었는데 Route를 Routes로 감싸고 또 얘네를 Router로 감싸야지 에러가 해결되었다. 이런식으로 감싸줘야한다. 이번에 TypeScript를 처음 배워보면서 사용해보았는데 컴포넌트의 타입을 설정해주다가 React.VFC 그리고 React.FC 를 알게되었다. VFC와 FC는 각각 VoidFunctionComponent Functio.. 2022. 4. 8.
33.Tribonacci Sequence Description: 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 .. 2022. 4. 7.
32.Your order, please Description: Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result. Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0). If the input string is empty, return an empty string. The words in the input String will only contain valid consecutive numbers. Examples "is2 Thi1s T4est 3a" .. 2022. 4. 7.