
Codewars
小菜鸟快飞
菜鸟
展开
-
【Codewars_python 7kyu】:Regex validate PIN code
问题描述:ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything but exactly 4 digits or exactly 6 digits.If the function is passed a valid PIN string, return true, else return...原创 2019-09-04 20:34:40 · 390 阅读 · 0 评论 -
【Codewars python 5kyu】: String incrementer
问题描述:Your job is to write a function which increments a string, to create a new string.If the string already ends with a number, the number should be incremented by 1. If the string does not end ...原创 2019-09-07 11:11:41 · 419 阅读 · 0 评论 -
【Codewars python 4kyu】: Human readable duration format
问题描述:Your task in order to complete this Kata is to write a function which formats a duration, given as a number of seconds, in a human-friendly way.The function must accept a non-negative integer...原创 2019-09-07 11:11:47 · 371 阅读 · 0 评论 -
【Codewars python 4kyu】: Strings Mix
问题描述:Given two strings s1 and s2, we want to visualize how different the two strings are. We will only take into account thelowercaseletters (a to z). First let us count the frequency of eachlowe...原创 2019-09-07 11:12:00 · 369 阅读 · 0 评论 -
【Codewars python 4kyu】: Range Extraction
问题描述:A format for expressing an ordered list of integers is to use a comma separated list of eitherindividual integers or a range of integers denoted by the starting integer separated from the en...原创 2019-09-07 11:12:10 · 433 阅读 · 0 评论 -
【Codewars python 4kyu】: Hamming Numbers
问题描述:A *Hamming number* is a positive integer of the form 2i3j5k, for some non-negative integersi,j, andk.Write a function that computes thenth smallest Hamming number.Specifically:The fir...原创 2019-09-07 11:12:17 · 643 阅读 · 0 评论 -
【Codewars python 4kyu】: Breadcrumb Generator
问题描述:Asbreadcrumb menùsare quite popular today, I won't digress much on explaining them, leaving the wiki link to do all the dirty work in my place.What might not be so trivial is instead to get...原创 2019-09-07 11:12:23 · 496 阅读 · 0 评论 -
【Codewars python 6kyu】: Valid Braces
问题描述:Write a function that takes a string of braces, and determines if the order of the braces is valid. It should returntrueif the string is valid, andfalseif it's invalid.This Kata is simila...原创 2019-09-08 15:44:52 · 320 阅读 · 0 评论 -
【Codewars python 4kyu】: Permutations
问题描述:In this kata you have to create all permutations of an input string and remove duplicates, if present. This means, you have to shuffle all letters from the input in all possible orders.Exampl...原创 2019-09-08 15:44:59 · 625 阅读 · 0 评论 -
【Codewars C++ 3kyu】: Path Finder #3: the Alpinist
问题描述:TaskYou are at start location[0, 0]in mountain area of NxN and you canonlymove in one of the four cardinal directions (i.e. North, East, South, West). Return minimal number ofclimb round...原创 2019-09-08 15:45:06 · 618 阅读 · 0 评论 -
【Codewars python 5kyu】: Pick peaks
问题描述:In this kata, you will write a function that returns the positions and the values of the "peaks" (or local maxima) of a numeric array.For example, the arrayarr = [0, 1, 2, 5, 1, 0]has a pea...原创 2019-09-08 15:45:11 · 449 阅读 · 0 评论 -
【Codewars python 4kyu】:Explosive Sum
问题描述:How many ways can you make the sum of a number?From wikipedia:https://en.wikipedia.org/wiki/Partition_(number_theory)#In number theory and combinatorics, a partition of a positive integer...原创 2019-09-08 15:45:25 · 905 阅读 · 0 评论 -
【Codewars python 5kyu】:Last digit of a large number
问题描述:Define a function that takes in two non-negative integersaandband returns the last decimal digit ofa^b. Note thataandbmay be very large!For example, the last decimal digit of9^7is...原创 2019-09-08 15:45:30 · 468 阅读 · 0 评论 -
【Codewars python 3kyu】:Last digit of a huge number
问题描述:For a given list[x1, x2, x3, ..., xn]compute the last (decimal) digit ofx1 ^ (x2 ^ (x3 ^ (... ^ xn))).E. g.,last_digit([3, 4, 2]) == 1because3 ^ (4 ^ 2) = 3 ^ 16 = 43046721.Beware:...原创 2019-09-08 15:45:36 · 913 阅读 · 0 评论 -
【Codewars python 6kyu】: Take a Number And Sum Its Digits Raised To The Consecutive Powers And ....¡E
问题描述:The number89is the first integer with more than one digit that fulfills the property partially introduced in the title of this kata. What's the use of saying "Eureka"? Because this sum gives ...原创 2019-09-07 11:11:35 · 719 阅读 · 0 评论 -
【Codewars python 5kyu】: Directions Reduction
问题描述:Once upon a time, on a way through the old wild west,…… a man was given directions to go from one point to another. The directions were "NORTH", "SOUTH", "WEST", "EAST". Clearly "NORTH" and "...原创 2019-09-07 11:11:29 · 386 阅读 · 0 评论 -
【Codewars python 7kyu】: Isograms
问题描述:An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the em...原创 2019-09-05 11:18:58 · 325 阅读 · 0 评论 -
【Codewars python 7kyu】: List Filtering
问题描述:In this kata you will create a function that takes a list of non-negative integers and strings and returns a new list with the strings filtered out.Example:filter_list([1,2,'a','b']) == [1...原创 2019-09-05 11:19:24 · 354 阅读 · 0 评论 -
【Codewars python 8kyu】: Multiply
问题描述:The code does not execute properly. Try to figure out why.代码实现:def multiply(a, b): return a * b原创 2019-09-05 11:19:34 · 277 阅读 · 0 评论 -
【Codewars python 7kyu】: You're a square!
问题描述:A square of squaresYou like building blocks. You especially like building blocks that are squares. And what you even like more, is to arrange them into a square of square building blocks!Ho...原创 2019-09-05 11:19:43 · 1089 阅读 · 0 评论 -
【Codewars python 7kyu】: Remove the minimum
问题描述:The museum of incredible dull thingsThe museum of incredible dull things wants to get rid of some exhibitions. Miriam, the interior architect, comes up with a plan to remove the most boring e...原创 2019-09-05 11:19:51 · 728 阅读 · 0 评论 -
【Codewars python 6kyu】: Build Tower
问题描述:Build TowerBuild Tower by the following given argument:number of floors(integer and always greater than 0).Tower block is represented as*Python: return alist; JavaScript: returns anA...原创 2019-09-05 11:20:08 · 659 阅读 · 0 评论 -
【Codewars python 6kyu】: Split Strings
问题描述:Complete the solution so that it splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the fi...原创 2019-09-05 11:20:16 · 429 阅读 · 0 评论 -
【Codewars python 5kyu】: Rot13
问题描述:ROT13 is a simple letter substitution cipher that replaces a letter with the letter 13 letters after it in the alphabet. ROT13 is an example of the Caesar cipher.Create a function that takes ...原创 2019-09-05 11:20:23 · 347 阅读 · 0 评论 -
【Codewars JavaScript 5kyu】: Scramblies
问题描述:Complete the functionscramble(str1, str2)that returnstrueif a portion ofstr1characters can be rearranged to matchstr2, otherwise returnsfalse.Notes:Only lower case letters will be u...原创 2019-09-05 11:20:30 · 495 阅读 · 0 评论 -
【Codewars python 6kyu】: Does my number look big in this?
问题描述:ANarcissistic Numberis a 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...原创 2019-09-05 11:20:37 · 569 阅读 · 0 评论 -
【Codewars python 6kyu】: Write Number in Expanded Form
问题描述:Write Number in Expanded FormYou will be given a number and you will need to return it as a string inExpanded Form. For example:expanded_form(12) # Should return '10 + 2'expanded_form(42...原创 2019-09-08 15:45:19 · 876 阅读 · 0 评论 -
【Codewars python 5kyu】: First non-repeating character
问题描述:Write a function namedfirst_non_repeating_letterthat takes a string input, and returns the first character that is not repeated anywhere in the string.For example, if given the input'stres...原创 2019-09-07 11:11:13 · 437 阅读 · 0 评论 -
【Codewars python 5kyu】: Number of trailing zeros of N!
问题描述:Write a program that will calculate the number of trailing zeros in a factorial of a given number.N! = 1 * 2 * 3 * ... * NBe careful1000!has 2568 digits...For more info, see:http://mat...原创 2019-09-07 11:11:23 · 471 阅读 · 0 评论 -
【Codewars python 4kyu】:Total increasing or decreasing numbers up to a power of 10
问题描述:Let's defineincreasingnumbers as the numbers whose digits, read from left to right, are never less than the previous ones: 234559 is an example of increasing number.Conversely,decreasingn...原创 2019-09-08 15:45:42 · 537 阅读 · 0 评论