Toc
  1. javascript - 7 kyu Love vs friendship
  • shell - 8kyu Even or Odd
  • shell - 8kyu Opposite number
  • Toc
    0 results found
    catzillaorz
    codewars mangic
    2019/12/09 codewars codewars
    javascript - 7 kyu Love vs friendship
    • 7 kyu Love vs friendship
    If a = 1, b = 2, c = 3 ... z = 26

    Then l + o + v + e = 54

    and f + r + i + e + n + d + s + h + i + p = 108

    So friendship is twice stronger than love :-)

    The input will always be in lowercase and never be empty.
    • solution:
    const wordsToMarks = s => [...s].reduce((res, c) => res += c.charCodeAt() - 96, 0)

    shell - 8kyu Even or Odd

    • 8kyu Even or Odd

    #!/bin/bash
    # your code here

    (( $1 & 1 )) && echo "Odd" || echo "Even"

    shell - 8kyu Opposite number

    • 8kyu Opposite number

    #!/bin/bash
    echo "- $1" | bc
    打赏
    支付宝
    微信
    本文作者:catzillaorz
    版权声明:本文首发于catzillaorz的博客,转载请注明出处!