일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- and
- map
- index
- Algorithm
- LOWER
- or
- MAX
- sum
- len
- 위코드
- join
- STR
- iNT
- range
- slice
- DART
- lambda
- Python
- decorator
- SQL
- FOR
- split
- Sorted
- WECODE
- list
- count
- enumerate
- js
- If
- 파이썬
- Today
- Total
목록Algorithm (101)
코드로 우주평화
Description: We want to generate a function that computes the series starting from 0 and ending until the given number. Example: Input: > 6 Output: 0+1+2+3+4+5+6 = 21 Input: > -15 Output: -15 0 Output: 0=0 Solution: 1. If n is 0, "0=0" is returned. 2. If n is negative, "n
Given an integer as input, can you round it to the next (meaning, "higher") multiple of 5? Examples: input: output: 0 -> 0 2 -> 5 3 -> 5 12 -> 15 21 -> 25 30 -> 30 -2 -> 0 -5 -> -5 etc. Input may be any positive or negative integer (including 0). You can assume that all inputs are valid integers. Solution: 1. Divide n by 5 and round up. 2. Multiply the rounded value by 5. def round_to_next5(n): ..
Instructions Write a function that takes a single string (word) as argument. The function must return an ordered list containing the indexes of all capital letters in the string. Example Test.assertSimilar( capitals('CodEWaRs'), [0,3,4,6] ); Solution: 1. Find the uppercase character in the string. 2. It returns the index of the corresponding character in an array. def capitals(word): return [i f..
You will be given an array of objects (associative arrays in PHP, table in COBOL) representing data about developers who have signed up to attend the next coding meetup that you are organising. Your task is to return an object (associative array in PHP, table in COBOL) which includes the count of each coding language represented at the meetup. For example, given the following input array: list1 ..
Some people just have a first name; some people have first and last names and some people have first, middle and last names. You task is to initialize the middle names (if there is any). Examples 'Jack Ryan' => 'Jack Ryan' 'Lois Mary Lane' => 'Lois M. Lane' 'Dimitri' => 'Dimitri' 'Alice Betty Catherine Davis' => 'Alice B. C. Davis' Solution: 1. If there are 3 or more elements of name, only the f..
Given an array of numbers, return a new array of length number containing the last even numbers from the original array (in the same order). The original array will be not empty and will contain at least "number" even numbers. For example: ([1, 2, 3, 4, 5, 6, 7, 8, 9], 3) => [4, 6, 8] ([-22, 5, 3, 11, 26, -6, -7, -8, -9, -8, 26], 2) => [-8, 26] ([6, -25, 3, 7, 5, 5, 7, -3, 23], 1) => [6] Solutio..
There is a bus moving in the city, and it takes and drop some people in each bus stop. You are provided with a list (or array) of integer pairs. Elements of each pair represent number of people get into bus (The first item) and number of people get off the bus (The second item) in a bus stop. Your task is to return number of people who are still in the bus after the last bus station (after the l..
Trolls are attacking your comment section! A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat. Your task is to write a function that takes a string and return a new string with all vowels removed. For example, the string "This website is for losers LOL!" would become "Ths wbst s fr lsrs LL!". Note: for this kata y isn't cons..
The Western Suburbs Croquet Club has two categories of membership, Senior and Open. They would like your help with an application form that will tell prospective members which category they will be placed. To be a senior, a member must be at least 55 years old and have a handicap greater than 7. In this croquet club, handicaps range from -2 to +26; the better the player the lower the handicap. I..
Create a function which answers the question "Are you playing banjo?". If your name starts with the letter "R" or lower case "r", you are playing banjo! The function takes a name as its only argument, and returns one of the following strings: name + " plays banjo" name + " does not play banjo" Names given are always valid strings. Solution: 1. Check if the first letter of 'name' is 'r'. 2. If it..