
codewars
文章平均质量分 58
渣渣琪
菜鸟成长记
展开
-
入坑codewars第二天-Basic Mathematical Operations、Ones and Zeros
一、题目需要实现 +对应加法需要实现 -对应减法……以此类推二、求解简单的if语句二、题二题意就是:将列表中的数字看成一串二进制然后转成十进制数我的思路是:先把列表颠倒,这里注意列表a,a.reverse()就直接把a颠倒了;因为二进制是从右到左读,因此我先颠倒从左往右方便计算。(1)先颠倒列表:(2)循环用列表数字乘以2^n(...原创 2018-11-23 08:50:29 · 370 阅读 · 0 评论 -
入坑codewars第15天-Regexp Basics - is it IPv4 address?
题目:Implement String#ipv4_address?, which should return true if given object is an IPv4 address - four numbers (0-255) separated by dots.It should only accept addresses in canonical representation,...原创 2018-12-14 15:31:01 · 218 阅读 · 0 评论 -
入坑codewars第18天-Alphabet wars - nuclear strike
题目:Alphabet wars - nuclear strikeIntroductionThere is a war and nobody knows - the alphabet war!The letters hide in their nuclear shelters. The nuclear strikes hit the battlefield and killed a lo...原创 2018-12-20 17:17:31 · 323 阅读 · 0 评论 -
入坑codewars第16天-Transformation of a Number Through Prime Factorization
题目:Every natural number, n, may have a prime factorization like:We define the geometric derivative of n, as a number with the following value:For example: calculate the value of n* for n = 2...原创 2018-12-15 20:11:48 · 188 阅读 · 0 评论 -
入坑codewars第11天-Clock in Mirror
题目一:Peter can see a clock in the mirror from the place he sits in the office. When he saw the clock shows 12:22He knows that the time is 11:38in the same manner:05:25 --> 06:3501:50 -->...原创 2018-12-10 11:43:25 · 343 阅读 · 0 评论 -
入坑codewars第19天-Calculating with Functions
题目:This time we want to write calculations using functions and get the results. Let's have a look at some examples:JavaScript:seven(times(five())); // must return 35four(plus(nine())); // must...原创 2018-12-21 11:09:28 · 978 阅读 · 0 评论 -
入坑codewars第17天-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 "SO.原创 2018-12-16 14:04:21 · 801 阅读 · 2 评论 -
入坑codewars第12天-Best travel
题目一:John and Mary want to travel between a few towns A, B, C ... Mary has on a sheet of paper a list of distances between these towns. ls = [50, 55, 57, 58, 60]. John is tired of driving and he says...原创 2018-12-11 19:41:33 · 1337 阅读 · 0 评论 -
入坑codewars第20天- 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 a ...原创 2018-12-25 11:31:03 · 612 阅读 · 0 评论 -
入坑codewars第21天-Numbers that are a power of their sum of digits
新年第一道题,已经几个月没写了,哎,毕业设计整不出The number 81 has a special property, a certain power of the sum of its digits is equal to 81 (nine squared). Eighty one (81), is the first number in having this property (n...原创 2019-02-09 23:09:44 · 426 阅读 · 0 评论 -
入坑codewars第十天-Product of consecutive Fib numbers、longest_palindrome
题目:The Fibonacci numbers are the numbers in the following integer sequence (Fn):0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, ...such asF(n) = F(n-1) + F(n-2) with F(0) = 0 and F...原创 2018-12-07 11:21:42 · 387 阅读 · 0 评论 -
入坑codewars第九天-Title Case
题目:Title CaseA string is considered to be in title case if each word in the string is either (a) capitalised (that is, only the first letter of the word is in upper case) or (b) considered to be a...原创 2018-12-06 21:18:30 · 490 阅读 · 0 评论 -
入坑codewars第一天-Invert values、String repeat、List Filtering
今天导师给开了会让我们每天在codewars上至少刷两道题,提高自己的python编程能力。不刷不知道一刷吓一跳。果然自己的编程能力很菜。实践出真知。一、题目题目说明:就是将列表中所有的取反,题目很简单,但是我不太会运用python代码二、求解就是一个for循环,利用了python代码独有的列表推导[-i for i in lst]意思是lst列表中所有数取反。虽然我知道有...原创 2018-11-22 12:38:00 · 336 阅读 · 0 评论 -
入坑codewars第三天-Build a pile of Cubes、Convert boolean values to strings 'Yes' or 'No'、Build Tower
第一题:Build a pile of Cubes:Your task is to construct a building which will be a pile of n cubes. The cube at the bottom will have a volume of n^3, the cube above will have volume of (n-1)^3 and so ...原创 2018-11-24 10:34:55 · 650 阅读 · 0 评论 -
入坑codewars第四天-Delete occurrences of an element if it occurs more than n times、Sum of odd numbers
第一题:Enough is enough!Alice and Bob were on a holiday. Both of them took many pictures of the places they've been, and now they want to show Charlie their entire collection. However, Charlie doesn'...原创 2018-11-25 11:59:59 · 463 阅读 · 0 评论 -
入坑codewars第五天-Dubstep、Regex validate PIN code
第一题:题目:Polycarpus works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes ...原创 2018-11-26 13:27:38 · 435 阅读 · 0 评论 -
入坑codewars第六天-Highest Scoring Word、The Supermarket Queue
题目:Given a string of words, you need to find the highest scoring word.Each letter of a word scores points according to it's position in the alphabet: a = 1, b = 2, c = 3 etc.You need to return t...原创 2018-11-27 19:20:25 · 784 阅读 · 0 评论 -
入坑codewars第七天-Maximum subarray sum、Are they the “same”?
题目:题意:求连续子序列的和的最大值 思路:笨方法一个一个求:首先求第一个数分别加后面的数取一个最大值然后下一个数分别加后面的数取最大值以此类推……代码如下:def maxSequence(arr): maxsum=0 for i in range(0,len(arr)): sum1=0 for j in range...原创 2018-11-28 11:44:58 · 451 阅读 · 0 评论 -
入坑codewars第八天-Help the bookseller !
今天只写了一道题不容易呀,实在不懂输出格式,于是想办法凑出来的……题目:A bookseller has lots of books classified in 26 categories labeled A, B, ... Z. Each book has a code c of 3, 4, 5 or more capitals letters. The 1st letter of a ...原创 2018-12-05 21:10:49 · 485 阅读 · 0 评论 -
入坑codewars第13天- Dashatize it
第一题:Given a number, return a string with dash'-'marks before and after each odd integer, but do not begin or end the string with a dash mark.Ex:dashatize(274) -> '2-7-4'dashatize(6815) ->...原创 2018-12-12 20:38:22 · 401 阅读 · 0 评论 -
入坑codewars第14天-Where is my parent!?(cry)
题目:Mothers arranged dance party for children in school.On that party there are only mothers and their children.All are having great fun on dancing floor when suddenly all lights went out.Its dark ni...原创 2018-12-13 16:24:28 · 484 阅读 · 0 评论 -
The Primes as a Result of the Longest Consecutive Sum I
好久没写codewars,哎,颓废了好多天。今天一写一题就是一天最后还是timeout,尴尬至极,但是至少输出答案都能对,需要优化代码。题目:https://www.codewars.com/kata/the-primes-as-a-result-of-the-longest-consecutive-sum-i/train/pythonThe Primes as a Result...原创 2019-07-22 19:52:35 · 219 阅读 · 0 评论