본문 바로가기

Algorithm/Code Fights (Code Signal)

(68)
Aracade Intro #52 longestWord. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Aracade Intro #52 longestWord. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Q. Define a word as a sequence of consecutive English letters. Find the longest word from the given string. 단어를 일련된 영문자들의 연속으로 정의해라. 주어진 문자열에서 가장 긴 단어를 찾아라. e.g. Input -> text = "Ready, steady, go!" Output -> longestWord(text) = "steady" //Process //1. Input text//2. Iterate from..
Aracade Intro #51 deleteDigit. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Aracade Intro #51 deleteDigit. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Q. Given some integer, find the maximal number you can obtain by deleting exactly one digit of the given number. 주어진 정수에서, 딱 1개의 자릿수만 지워서 얻을 수 있는 가장 큰 숫자를 찾아봐라 e.g. Input -> n = 152 Output -> deleteDigit(n) = 52 Input -> n = 1001 Output -> deleteDigit(n) = 101 //Process //1. Inpu..
Aracade Intro #50 chessKnight. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Aracade Intro #50 chessKnight. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Q. Given a position of a knight on the standard chessboard, find the number of different moves the knight can perform. The knight can move to a square that is two squares horizontally and one square vertically, or two squares vertically and one square horizontally away from it. T..
Aracade Intro #49 lineEncoding. Algorithm, 알고리즘 문제풀이, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Aracade Intro #49 lineEncoding. Algorithm, 알고리즘 문제풀이, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Q. Given a string, return its encoding defined as follows: First, the string is divided into the least possible number of disjoint substrings consisting of identical charactersfor example, "aabbbc" is divided into ["aa", "bbb", "c"]Next, each substring with length greater t..
Aracade Intro #48 isDigit. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Aracade Intro #48 isDigit. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Q. Determine if the given character is a digit or not. 주어진 문자가 숫자인지 아닌지 확인해봐라 e.g. Input -> symbol = '0' Output -> isDigit(symbol) = true Input -> symbol = '-' Output -> isDigit(symbol) = false //Process //1. Input char symbol//2. Check if it's in the range of digit (ascii)// 2.1. If..
Aracade Intro #47 isMAC48Address. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Aracade Intro #47 isMAC48Address. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Q. A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment. The standard (IEEE 802) format for printing MAC-48 addresses in human-friendly form is six groups of two hexadecimal digits..
Aracade Intro #46 electionsWinners. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Aracade Intro #46 electionsWinners. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Q. Elections are in progress! Given an array of the numbers of votes given to each of the candidates so far, and an integer k equal to the number of voters who haven't cast their vote yet, find the number of candidates who still have a chance to win the election. The winner ..
Aracade Intro #45 buildPalindrome. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Aracade Intro #45 buildPalindrome. Algorithm, 알고리즘, Codefights, CodeSignal, 코드파이트, 코드시그널, 예제, example, c++ java c# scalar Q. Given a string, find the shortest possible string which can be achieved by adding characters to the end of initial string to make it a palindrome. 주어진 문자열에서, 가장 적은수의 문자를 추가해서 회문 문자가 가능하게 되는 문자열를 찾아라. ( 회문 - 수박이박수 처럼 앞뒤로 읽어도 같은 것 ) e.g. Input -> st = "abcdc" Output -> build..