일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- WECODE
- js
- MAX
- map
- decorator
- 위코드
- enumerate
- slice
- join
- Python
- Sorted
- and
- count
- If
- or
- split
- len
- 파이썬
- range
- list
- Algorithm
- SQL
- iNT
- STR
- FOR
- sum
- lambda
- LOWER
- DART
- index
- Today
- Total
목록MAX (15)
코드로 우주평화
Task Given an array of integers , Find the maximum product obtained from multiplying 2 adjacent numbers in the array. Notes Array/list size is at least 2. Array/list numbers could be a mixture of positives, negatives also zeroes . Input >> Output Examples adjacentElementsProduct([1, 2, 3]); ==> return 6 Explanation: The maximum product obtained from multiplying 2 * 3 = 6, and they're adjacent nu..
Create a combat function that takes the player's current health and the amount of damage recieved, and returns the player's new health. Health can't be less than 0. Solution: def combat(health, damage): return max(health-damage, 0)
The Story: Bob is working as a bus driver. However, he has become extremely popular amongst the city's residents. With so many passengers wanting to get aboard his bus, he sometimes has to face the problem of not enough space left on the bus! He wants you to write a simple program telling him if he will be able to fit all the passengers. Task Overview: You have to write a function that accepts t..
The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers: max_sequence([-2, 1, -3, 4, -1, 2, 1, -5, 4]) # should be 6: [4, -1, 2, 1] Easy case is when the list is made up of only positive numbers and the maximum sum is the sum of the whole array. If the list is made up of only negative numbers, return 0 instead. Empty list i..
You will be given an array and a limit value. You must check that all values in the array are below or equal to the limit value. If they are, return true. Else, return false. You can assume all values in the array are numbers. Solution: def small_enough(array, limit): return max(array)
Build Tower Build a pyramid-shaped tower given a positive integer number of floors. A tower block is represented with "*" character. For example, a tower with 3 floors looks like this: [ " * ", " *** ", "*****" ] And a tower with 6 floors looks like this: [ " * ", " *** ", " ***** ", " ******* ", " ********* ", "***********" ] Solution: def tower_builder(n_floors): nums = [i>0 and i*2+1 or 1 for..
Given a string of words, you need to find the highest scoring word. Each letter of a word scores points according to its position in the alphabet: a = 1, b = 2, c = 3 etc. You need to return the highest scoring word as a string. If two words score the same, return the word that appears earliest in the original string. All letters will be lowercase and all inputs will be valid. Solution: def high..
The first input array is the key to the correct answers to an exam, like ["a", "a", "b", "d"]. The second one contains a student's submitted answers. The two arrays are not empty and are the same length. Return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer, represented as an empty string (in C the space characte..
Given a table of random numbers as follows: numbers table schema id number1 number2 Your job is to return table with similar structure and headings, where if the sum of a column is odd, the column shows the minimum value for that column, and when the sum is even, it shows the max value. You must use a case statement. output table schema number1 number2 Solution: SELECT CASE WHEN MOD(SUM(number1)..
or this challenge you need to create a simple MIN / MAX statement that will return the Minimum and Maximum ages out of all the people. people table schema id name age select table schema age_min (minimum of ages) age_max (maximum of ages) Solution: SELECT MIN(age) AS age_min, MAX(age) AS age_max FROM people Result: age_min age_max 11 99