Xuj's blog


  • 首页

  • 分类

  • 关于

  • 归档

  • 标签

nextSmallerNumber

发表于 2017-12-29 | 分类于 codewars
titleYou have to create a function that takes a positive integer number and returns the next bigger number formed by the same digits:123nextBigger(12)==21nextBigger(513)==531nextBigger(2017)==2071 If no bigger number can be composed using those digits, return -1: 123nextBigger(9)==-1nextBigger(111)= ...
阅读全文 »

Roman Numerals Decoder

发表于 2017-12-28 | 分类于 codewars
titleCreate a function that takes a Roman numeral as its argument and returns its value as a numeric decimal integer. You don’t need to validate the form of the Roman numeral. Modern Roman numerals are written by expressing each decimal digit of the number to be encoded separately, starting with the ...
阅读全文 »

coordinates-validator

发表于 2017-12-27 | 分类于 codewars
titleYou need to create a function that will validate if given parameters are valid geographical coordinates. Valid coordinates look like the following: “23.32353342, -32.543534534”. The return value should be either true or false. Latitude (which is first float) can be between 0 and 90, positive or ...
阅读全文 »

Pascal's-Triangle

发表于 2017-12-26 | 分类于 codewars
title Wikipedia article on Pascal’s Triangle: http://en.wikipedia.org/wiki/Pascal’s_triangle example1pascalsTriangle(4) == [1,1,1,1,2,1,1,3,3,1] My solution123456789101112131415function pascalsTriangle(n) { //return a flat array representing the values of Pascal's Triangle to the n-th level ...
阅读全文 »

merged-string-checker

发表于 2017-12-25 | 分类于 codewars
titleAt a job interview, you are challenged to write an algorithm to check if a given string, s, can be formed from two other strings, part1 and part2. The restriction is that the characters in part1 and part2 are in the same order as in s. The interviewer gives you the following example and tells y ...
阅读全文 »

break-camelCase

发表于 2017-12-25 | 分类于 codewars
titleComplete the solution so that the function will break up camel casing, using a space between words. example1solution('camelCasing') // => should return 'camel Casing' My solution12345678910111213function solution(string) { var newString = string.toLowerCase(); var result = []; ...
阅读全文 »

Next bigger number with the same digits***

发表于 2017-12-21 | 分类于 codewars
titleYou have to create a function that takes a positive integer number and returns the next bigger number formed by the same digits:123nextBigger(12)==21nextBigger(513)==531nextBigger(2017)==2071 If no bigger number can be composed using those digits, return -1: 123nextBigger(9)==-1nextBigger(111)= ...
阅读全文 »

uniqueInOrder

发表于 2017-12-20 | 分类于 codewars
titleImplement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements. example123uniqueInOrder('AAAABBBCCDAABBB') == ['A', 'B', 'C', 'D', 'A', 'B']uniqueInOr ...
阅读全文 »

whereMyAnagramsAt

发表于 2017-12-20 | 分类于 codewars
titleWhat is an anagram? Well, two words are anagrams of each other if they both contain the same letters. For example: 12345'abba' & 'baab' == true'abba' & 'bbaa' == true'abba' & 'abbba' == false exampleWrite a function that will find all the anagrams of a word from a list. You will be ...
阅读全文 »

humanReadableTime

发表于 2017-12-19 | 分类于 codewars
titleWrite a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (HH:MM:SS) example12345Test.assertEquals(humanReadable(0), '00:00:00', 'humanReadable(0)');Test.assertEquals(humanReadable(5), '00:00:05', 'humanReadable(5)');Test.assertEqual ...
阅读全文 »
1234
徐俊

徐俊

以梦为马,明日天涯

32 日志
6 分类
8 标签
GitHub
其他
  • 张鑫旭
© 皖ICP备17015096号 徐俊