![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
codewars专题
三只佩奇不结义
士人有百折不回之真心,方有万变不穷之妙用。
展开
-
Python语言Codewars实战——Sudoku Solution Validator(4 kyu)
Description:Sudoku BackgroundSudoku is a game played on a 9x9 grid. The goal of the game is to fill all cells of the grid with digits from 1 to 9, so that each column, each row, and each of the nine 3x3 sub-grids (also known as blocks) contain all of the原创 2020-11-22 11:04:30 · 370 阅读 · 0 评论 -
R语言Codewars实战——Sum by Factors(4kyu)
Description:Given an array of positive or negative integersI= [i1,..,in]you have to produce a sorted array P of the form[ [p, sum of all ij of I for which p is a prime factor (p positive) of ij] ...]P will be sorted by increasing order of the prime nu原创 2020-08-19 14:03:08 · 395 阅读 · 0 评论 -
R语言Codewars实战——Best travel(5kyu)
Description: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 to Mary that he doesn’t want to drive more than t原创 2020-08-18 22:57:01 · 814 阅读 · 0 评论 -
R语言Codewars实战——Exponentials as fractions(4kyu)
Description:The aim is to calculate exponential(x) (written exp(x)in most math libraries) as an irreducible fraction, the numerator of this fraction having a given number of digits.We call this function expand, it takes two parameters, x of which we want原创 2020-08-18 18:24:55 · 472 阅读 · 0 评论 -
R语言Codewars实战——Fibo akin(5kyu)
Description:Be u(n) a sequence beginning with:u[1] = 1, u[2] = 1, u[3] = 2, u[4] = 3, u[5] = 3, u[6] = 4,u[7] = 5, u[8] = 5, u[9] = 6, u[10] = 6, u[11] = 6, u[12] = 8,u[13] = 8, u[14] = 8, u[15] = 10, u[16] = 9, u[17] = 10, u[18]原创 2020-08-17 00:32:16 · 304 阅读 · 0 评论 -
R语言Codewars实战——Twice linear(4kyu)
Consider a sequence u where u is defined as follows:The number u(0) = 1 is the first one in u.For each x in u, then y = 2 * x + 1 and z = 3 * x + 1 must be in u too.There are no other numbers in u.Ex: u = [1, 3, 4, 7, 9, 10, 13, 15, 19, 21, 22, 27, …]原创 2020-08-16 22:34:34 · 292 阅读 · 0 评论 -
R语言Codewars实战——Number of trailing zeros of N!(5kyu)
Description:Write a program that will calculate the number of trailing zeros in a factorial of a given number.N! = 1 * 2 * 3 * … * NBe careful 1000! has 2568 digits…For more info, see: http://mathworld.wolfram.com/Factorial.htmlExampleszeros(6) = 1#原创 2020-08-16 11:34:30 · 277 阅读 · 0 评论 -
R语言Codewars实战——Rainfall
说明:这道题是真难到我了,主要是我不清楚怎么把字母之间的数字匹配出来,我初始的时候想的是正则表达式,但是R语言的正则表达式与我在python中学到的不同,且更加麻烦复杂,再者我又对正则表达式一知半解的,脑子真就慢慢变得迷糊了,直接看了别人的解法(整半天经验没变化,难受啊)。Description:data and data1 are two strings with rainfall records of a few cities for months from January to December.原创 2020-08-14 17:46:40 · 387 阅读 · 0 评论 -
R语言Codewars实战——Help the bookseller !(6kyu)
Description: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 characters. The 1st character of a code is a capital letter which defines the book category.In the bookseller’s stockli原创 2020-08-13 11:03:24 · 277 阅读 · 0 评论 -
R语言Codewars实战——Last digit of a large number(5kyu)
Description:Define a function that takes in two non-negative integers a and b and returns the last decimal digit of a^b. Note that a and b may be very large!For example, the last decimal digit of 9^7 is 9, since 9^7 = 4782969. The last decimal digit of (原创 2020-08-13 23:47:06 · 1264 阅读 · 0 评论