codeeval

SPLIT THE NUMBER(CodeEval)

CHALLENGE DESCRIPTION: You are given a number N and a pattern. The pattern consists of lowercase latin letters and one operation "+" or "-". The challenge is to split the number and evaluate it according to this pattern e.g. 1232 ab+cd -> …

COMPRESSED SEQUENCE(CodeEval)

美しくない。 CHALLENGE DESCRIPTION: Assume that someone dictates you a sequence of numbers and you need to write it down. For brevity, he dictates it as follows: first says the number of consecutive identical numbers and then says the numb…

ROAD TRIP(CodeEval)

CHALLENGE DESCRIPTION: You've decided to make a road trip across the country in a straight line. You have chosen the direction you'd like to travel and made a list of cities in that direction that have gas stations to stop at and fill up y…

HIDDEN DIGITS(CodeEval)

CHALLENGE DESCRIPTION: In this challenge you're given a random string containing hidden and visible digits. The digits are hidden behind lower case latin letters as follows: 0 is behind 'a', 1 is behind ' b ' etc., 9 is behind 'j'. Any oth…

MORSE CODE(CodeEval)

CHALLENGE DESCRIPTION: You have received a text encoded with Morse code and want to decode it. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the following: .- ...- ..--- .-- .... .. .…

MIXED CONTENT(CodeEval)

CHALLENGE DESCRIPTION: You have a string of words and digits divided by comma. Write a program which separates words with digits. You shouldn't change the order elements. INPUT SAMPLE: Your program should accept as its first argument a pat…

MULTIPLY LISTS(CodeEval)

CHALLENGE DESCRIPTION: You have 2 lists of positive integers. Write a program which multiplies corresponding elements in these lists. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the…

SWAP ELEMENTS(CodeEval)

CHALLENGE DESCRIPTION: You are given a list of numbers which is supplemented with positions that have to be swapped. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the following 1 2 3 …

LONGEST WORD(CodeEval)

CHALLENGE DESCRIPTION: In this challenge you need to find the longest word in a sentence. If the sentence has more than one word of the same length you should pick the first one. INPUT SAMPLE: Your program should accept as its first argume…

SHORTEST REPETITION(CodeEval)

CHALLENGE DESCRIPTION: Write a program to determine the shortest repetition in a string. A string is said to have period p if it can be formed by concatenating one or more repetitions of another string of length p. For example, the string …

ROMAN NUMERALS(CodeEval)

CHALLENGE DESCRIPTION: Many persons are familiar with the Roman numerals for relatively small numbers. The symbols I (capital i), V, X, L, C, D, and M represent the decimal values 1, 5, 10, 50, 100, 500 and 1000 respectively. To represent …

WORD TO DIGIT(CodeEval)

CHALLENGE DESCRIPTION: Having a string representation of a set of numbers you need to print this numbers. All numbers are separated by semicolon. There are up to 20 numbers in one line. The numbers are "zero" to "nine" INPUT SAMPLE: Your p…

LOWEST UNIQUE NUMBER(CodeEval)

CHALLENGE DESCRIPTION: here is a game where each player picks a number from 1 to 9, writes it on a paper and gives to a guide. A player wins if his number is the lowest unique. We may have 10-20 players in our game. INPUT SAMPLE: Your prog…

JSON MENU IDS(CodeEval)

CHALLENGE DESCRIPTION: You have JSON string which describes a menu. Calculate the SUM of IDs of all "items" in the case a "label" exists for an item. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Inpu…

EVEN NUMBERS(CodeEval)

CHALLENGE DESCRIPTION: Write a program which checks input numbers and determines whether a number is even or not. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the following 701 4123 …

CALCULATE DISTANCE(CodeEval)

CHALLENGE DESCRIPTION: You have coordinates of 2 points and need to find the distance between them. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the following (25, 4) (1, -6) (47, 43…

FIND A WRITER(CodeEval)

西村京太郎先生は海外でも有名なんですね。 CHALLENGE DESCRIPTION: You have a set of rows with names of famous writers encoded inside. Each row is divided into 2 parts by pipe char (|). The first part has a writer's name. The second part is a…

SWAP CASE(CodeEval)

CHALLENGE DESCRIPTION: Write a program which swaps letters' case in a sentence. All non-letter characters should remain the same. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the fol…

CAPITALIZE WORDS(CodeEval)

CHALLENGE DESCRIPTION: Write a program which capitalizes the first letter of each word in a sentence. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the following Hello world javaScrip…

PENULTIMATE WORD(CodeEval)

CHALLENGE DESCRIPTION: Write a program which finds the next-to-last word in a string. INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the following some line with text another line Each…

SIMPLE SORTING(CodeEval)

20141118 追記 floatの結果を下3桁で表示するというを見落としていた。。。 ソートのアルゴリズムを問う問題じゃなかった。すごい勘違いしてた。 simple sortなので挿入ソートか選択ソートのことだと思うのですが、 codeevalで採点するとスコアが低いです。…

QUERY BOARD(CodeEval)

CHALLENGE DESCRIPTION: There is a board (matrix). Every cell of the board contains one integer, which is 0 initially. The next operations can be applied to the Query Board: SetRow i x: it means that all values in the cells on row "i" have …

BEAUTIFUL STRINGS(CodeEval)

ちょっと難しくなりました。 CHALLENGE DESCRIPTION: Credits: This problem appeared in the Facebook Hacker Cup 2013 Hackathon. When John was a little kid he didn't have much to do. There was no internet, no Facebook, and no programs to hack o…

HEX TO DECIMAL(CodeEval)

CHALLENGE DESCRIPTION: You will be given a hexadecimal (base 16) number. Convert it into decimal (base 10). INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Each line in this file contains a hex number. …

N MOD M(CodeEval)

CHALLENGE DESCRIPTION: Given two integers N and M, calculate N Mod M (without using any inbuilt modulus operator). INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Each line in this file contains two com…

ARMSTRONG NUMBERS(CodeEval)

こういう数値のことをArmstrong Numbersっていうんですね。 CHALLENGE DESCRIPTION: An Armstrong number is an n-digit number that is equal to the sum of the n'th powers of its digits. Determine if the input numbers are Armstrong numbers. INPUT …

WORKING EXPERIENCE(CodeEval)

CodeEval 少し手こずりました。 CHALLENGE DESCRIPTION: You're building a new social platform and you want to store user's working experience. You've decided to calculate the total experience in years for each user based on the time periods e…

DATA RECOVERY(CodeEval)

CHALLENGE DESCRIPTION Your friends decided to make a fun of you. They've installed a script to your computer which shuffled all of the words within a text. It was a joke, so they've left hints for each sentence which allow you to easily re…

LETTERCASE PERCENTAGE RATIO(CodeEval)

Your goal is to find the percentage ratio of lowercase and uppercase letters in line below. INPUT SAMPLE Your program should accept as its first argument a path to a filename. Each line of input contains a string with uppercase and lowerca…

JUGGLING WITH ZEROS(CodeEval)

CHALLENGE DESCRIPTION In this challenge you will be dealing with zero based numbers. A zero based number is set in the following form: "flag" "sequence of zeroes" "flag" "sequence of zeroes" etc. Separated by a single space. 00 0 0 00 00 0…